[MediaWiki-commits] [Gerrit] Interlanguage link: Simplify the autonym identification - change (mediawiki...ContentTranslation)
jenkins-bot has submitted this change and it was merged. Change subject: Interlanguage link: Simplify the autonym identification .. Interlanguage link: Simplify the autonym identification It is guaranteed that jquery.uls.data is loaded before createCXInterlanguageItem is called. So we can safely use $.uls.data.getAutonym() for getting the autonym. Change-Id: I89e1ed2f1b642230234b750055f2ca01995b9ea4 --- M modules/entrypoint/ext.cx.interlanguagelink.js 1 file changed, 1 insertion(+), 8 deletions(-) Approvals: Nikerabbit: Looks good to me, approved jenkins-bot: Verified diff --git a/modules/entrypoint/ext.cx.interlanguagelink.js b/modules/entrypoint/ext.cx.interlanguagelink.js index 0bb399e..1e14da2 100644 --- a/modules/entrypoint/ext.cx.interlanguagelink.js +++ b/modules/entrypoint/ext.cx.interlanguagelink.js @@ -79,14 +79,7 @@ function createCXInterlanguageItem( code ) { var from, $link, $item, autonym; - // Optimization: if it's just the user language, - // get the autonym from an available variable. - // Otherwise, get it from uls.data, which should be loaded by now. - if ( code === mw.config.get( 'wgUserLanguage' ) ) { - autonym = mw.config.get( 'wgULSCurrentAutonym' ); - } else { - autonym = $.uls.data.getAutonym( code ); - } + autonym = $.uls.data.getAutonym( code ); // TODO: This should be done more robustly. // We can't use something like wgContentLanguage because this // will fail for a wiki like simple.wikipedia.org, where -- To view, visit https://gerrit.wikimedia.org/r/240962 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I89e1ed2f1b642230234b750055f2ca01995b9ea4 Gerrit-PatchSet: 2 Gerrit-Project: mediawiki/extensions/ContentTranslation Gerrit-Branch: master Gerrit-Owner: SanthoshGerrit-Reviewer: Amire80 Gerrit-Reviewer: Nikerabbit Gerrit-Reviewer: Santhosh Gerrit-Reviewer: jenkins-bot <> ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Interlanguage link: Simplify the autonym identification - change (mediawiki...ContentTranslation)
Santhosh has uploaded a new change for review. https://gerrit.wikimedia.org/r/240962 Change subject: Interlanguage link: Simplify the autonym identification .. Interlanguage link: Simplify the autonym identification It is guaranteed that jquery.uls.data is loaded before createCXInterlanguageItem is called. So we can safely use $.uls.data.getAutonym() for getting the autonym. Change-Id: I89e1ed2f1b642230234b750055f2ca01995b9ea4 --- M modules/entrypoint/ext.cx.interlanguagelink.js 1 file changed, 1 insertion(+), 8 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation refs/changes/62/240962/1 diff --git a/modules/entrypoint/ext.cx.interlanguagelink.js b/modules/entrypoint/ext.cx.interlanguagelink.js index 166c81f..c585522 100644 --- a/modules/entrypoint/ext.cx.interlanguagelink.js +++ b/modules/entrypoint/ext.cx.interlanguagelink.js @@ -75,14 +75,7 @@ function createCXInterlanguageItem( code ) { var from, $link, $item, autonym; - // Optimization: if it's just the user language, - // get the autonym from an available variable. - // Otherwise, get it from uls.data, which should be loaded by now. - if ( code === mw.config.get( 'wgUserLanguage' ) ) { - autonym = mw.config.get( 'wgULSCurrentAutonym' ); - } else { - autonym = $.uls.data.getAutonym( code ); - } + autonym = $.uls.data.getAutonym( code ); // TODO: This should be done more robustly. // We can't use something like wgContentLanguage because this // will fail for a wiki like simple.wikipedia.org, where -- To view, visit https://gerrit.wikimedia.org/r/240962 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I89e1ed2f1b642230234b750055f2ca01995b9ea4 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/ContentTranslation Gerrit-Branch: master Gerrit-Owner: Santhosh___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits