jenkins-bot has submitted this change and it was merged. Change subject: Don't localize the namespace unnecessarily ......................................................................
Don't localize the namespace unnecessarily When the source title is set, mw.Title localizes the namespace name, which is incorrect, because the namespace names are usually different in source and target languages. This is especially felt when translating non-main-space pages from the English Wikipedia, where the namespace names are canonical, and are unnecessarily translated. Bug: T86744 Change-Id: I6c3996986d7b6f5bf0757c17e6dd505a0c6b0feb --- M modules/source/ext.cx.source.js 1 file changed, 14 insertions(+), 1 deletion(-) Approvals: Santhosh: Looks good to me, approved jenkins-bot: Verified diff --git a/modules/source/ext.cx.source.js b/modules/source/ext.cx.source.js index e6a4fdf..86616b3 100644 --- a/modules/source/ext.cx.source.js +++ b/modules/source/ext.cx.source.js @@ -89,7 +89,8 @@ * Render the source content column. */ ContentTranslationSource.prototype.render = function () { - var sourceLanguageDir, $languageLabel, $articleLink, userLanguage, $subHeading, title; + var sourceLanguageDir, title, namespace, + $languageLabel, $articleLink, userLanguage, $subHeading; sourceLanguageDir = $.uls.data.getDir( mw.cx.sourceLanguage ); this.$container.prop( { @@ -101,6 +102,18 @@ if ( title ) { mw.cx.sourceTitle = title.getPrefixedText(); + + if ( title.getNamespaceId() ) { // Non-main + // mw.Title's getPrefixedText() adds the localized namespace name, + // but it's localized for the current wiki's content language, + // and here we need the source. See + // https://phabricator.wikimedia.org/T86744 + // Avoid this problem for non-main-space pages by taking + // the namespace name from the current source title. + namespace = mw.cx.sourceTitle.match( '.+?:' )[ 0 ]; + + mw.cx.sourceTitle = namespace + title.getNameText(); + } } this.$title = $( '<h2>' ) -- To view, visit https://gerrit.wikimedia.org/r/236047 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I6c3996986d7b6f5bf0757c17e6dd505a0c6b0feb Gerrit-PatchSet: 5 Gerrit-Project: mediawiki/extensions/ContentTranslation Gerrit-Branch: master Gerrit-Owner: Amire80 <amir.ahar...@mail.huji.ac.il> Gerrit-Reviewer: Amire80 <amir.ahar...@mail.huji.ac.il> Gerrit-Reviewer: Nikerabbit <niklas.laxst...@gmail.com> Gerrit-Reviewer: Santhosh <santhosh.thottin...@gmail.com> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits