Petar.petkovic has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/398610 )
Change subject: Use uppercase "All" language code on smaller screens ...................................................................... Use uppercase "All" language code on smaller screens - Don't apply bcp47 on "All" pseudo language code, preventing the code from going lowercase on smaller screens. - Move registering of 'x-all' pseudo language code from dashboard to language filter. - Add default options to consturctor documentation of language filter. Bug: T182947 Change-Id: I62c8b4dd8c87d0ffa951980b69d7c13f9ee97758 --- M modules/dashboard/ext.cx.dashboard.js M modules/ui/mw.cx.ui.LanguageFilter.js 2 files changed, 19 insertions(+), 18 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation refs/changes/10/398610/1 diff --git a/modules/dashboard/ext.cx.dashboard.js b/modules/dashboard/ext.cx.dashboard.js index da455b3..7f3efa6 100644 --- a/modules/dashboard/ext.cx.dashboard.js +++ b/modules/dashboard/ext.cx.dashboard.js @@ -69,13 +69,6 @@ CXDashboard.prototype.init = function () { var self = this; - // 'all' could be valid language code, so we use extension mechanism and go with 'x-all' - $.uls.data.addLanguage( 'x-all', { - script: 'Latn', - regions: [ 'WW' ], - autonym: mw.msg( 'cx-translation-filter-uls-all-languages' ) - } ); - // Render the main components this.render(); diff --git a/modules/ui/mw.cx.ui.LanguageFilter.js b/modules/ui/mw.cx.ui.LanguageFilter.js index 5b96f31..ec4b06d 100644 --- a/modules/ui/mw.cx.ui.LanguageFilter.js +++ b/modules/ui/mw.cx.ui.LanguageFilter.js @@ -1,13 +1,21 @@ 'use strict'; +// Register 'All languages' in ULS data +// 'all' could be valid language code, so we use extension mechanism and go with 'x-all' +$.uls.data.addLanguage( 'x-all', { + script: 'Latn', + regions: [ 'WW' ], + autonym: mw.msg( 'cx-translation-filter-uls-all-languages' ) +} ); + /** * Language filter * * @class * @param {Object} [config] Configuration object - * @cfg {boolean} [canBeSame] True if source and target language can be the same langauge - * @cfg {boolean} [canBeUndefined] True if source or target language can be unset - * @cfg {boolean} [updateLocalStorage] True if this language selector can update local storage, + * @cfg {boolean} [canBeSame=false] True if source and target language can be the same langauge + * @cfg {boolean} [canBeUndefined=false] True if source or target language can be unset + * @cfg {boolean} [updateLocalStorage=false] True if this language selector can update local storage, * when source or target language changes * @cfg {Function} [onSourceLanguageChange] Callback invoked when source language changes * @cfg {Function} [onTargetLanguageChange] Callback invoked when target language changes @@ -308,10 +316,12 @@ * @param {string} language */ mw.cx.ui.LanguageFilter.prototype.setFilterLabel = function ( $filter, language ) { - var langProps; + var langProps, filterLabel; - if ( ( this.canBeUndefined && !language ) ) { - language = mw.msg( 'cx-translation-filter-label-all-languages' ); + if ( this.canBeUndefined && !language ) { + language = filterLabel = mw.msg( 'cx-translation-filter-label-all-languages' ); + } else { + filterLabel = mw.language.bcp47( language ); } langProps = { @@ -319,11 +329,9 @@ dir: $.uls.data.getDir( language ) }; - $filter.prop( langProps ) - .text( this.isNarrowScreenSize ? - mw.language.bcp47( language ) : - $.uls.data.getAutonym( language ) - ); + $filter + .prop( langProps ) + .text( this.isNarrowScreenSize ? filterLabel : $.uls.data.getAutonym( language ) ); }; /** -- To view, visit https://gerrit.wikimedia.org/r/398610 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I62c8b4dd8c87d0ffa951980b69d7c13f9ee97758 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/ContentTranslation Gerrit-Branch: master Gerrit-Owner: Petar.petkovic <ppetko...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits