Glaisher has uploaded a new change for review.
https://gerrit.wikimedia.org/r/294026
Change subject: PageTranslationHooks::replaceSubtitle: sync with core
......................................................................
PageTranslationHooks::replaceSubtitle: sync with core
I don't know what that comment means but I don't see why
the "<" shouldn't be present for translation pages.
Other changes:
- Use strpos() instead of preg_match() as PHP manual also recommends this
- Retrieve message from $skin instead of global wfMessage
- Prepend dirMarkEntity to pipe-separator
- Use Title::isKnown() instead of Title::exists()
Bug: T94004
Change-Id: Idb2ae16368eafdffb981ef9f86cb9438eb8979b7
---
M tag/PageTranslationHooks.php
1 file changed, 9 insertions(+), 8 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Translate
refs/changes/26/294026/1
diff --git a/tag/PageTranslationHooks.php b/tag/PageTranslationHooks.php
index 4e9d44f..b6cc642 100644
--- a/tag/PageTranslationHooks.php
+++ b/tag/PageTranslationHooks.php
@@ -801,7 +801,8 @@
/// Hook: SkinSubPageSubtitle
public static function replaceSubtitle( &$subpages, $skin = null,
OutputPage $out ) {
- if ( !TranslatablePage::isTranslationPage( $out->getTitle() )
+ $isTranslationPage = TranslatablePage::isTranslationPage(
$out->getTitle() );
+ if ( !$isTranslationPage
&& !TranslatablePage::isSourcePage( $out->getTitle() )
) {
return true;
@@ -810,23 +811,24 @@
// Copied from Skin::subPageSubtitle()
if ( $out->isArticle() && MWNamespace::hasSubpages(
$out->getTitle()->getNamespace() ) ) {
$ptext = $out->getTitle()->getPrefixedText();
- if ( preg_match( '/\//', $ptext ) ) {
+ if ( strpos( $ptext, '/' ) !== false ) {
$links = explode( '/', $ptext );
array_pop( $links );
- // Also pop of one extra for language code is
needed
- if ( TranslatablePage::isTranslationPage(
$out->getTitle() ) ) {
+ if ( $isTranslationPage ) {
+ // Also remove language code page
array_pop( $links );
}
$c = 0;
$growinglink = '';
$display = '';
+ $lang = $skin->getLanguage();
foreach ( $links as $link ) {
$growinglink .= $link;
$display .= $link;
$linkObj = Title::newFromText(
$growinglink );
- if ( is_object( $linkObj ) &&
$linkObj->exists() ) {
+ if ( is_object( $linkObj ) &&
$linkObj->isKnown() ) {
$getlink = Linker::linkKnown(
SpecialPage::getTitleFor( 'MyLanguage', $growinglink ),
htmlspecialchars(
$display )
@@ -835,10 +837,9 @@
$c++;
if ( $c > 1 ) {
- $subpages .= wfMessage(
'pipe-separator' )->plain();
+ $subpages .=
$lang->getDirMarkEntity() . $skin->msg( 'pipe-separator' )->escaped();
} else {
- // This one is stupid
imho, doesn't work with chihuahua
- // $subpages .= '< ';
+ $subpages .= '< ';
}
$subpages .= $getlink;
--
To view, visit https://gerrit.wikimedia.org/r/294026
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Idb2ae16368eafdffb981ef9f86cb9438eb8979b7
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Translate
Gerrit-Branch: master
Gerrit-Owner: Glaisher <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits