Avoid pointless use of isset() in LBFactoryMulti()
[mediawiki.git] / resources / src / mediawiki.language / mediawiki.language.fallback.js
blobb1bab02a375e104fe1680d5c23fc21d7bb79831c
1 /*
2  * Language-fallback-chain-related utilities for mediawiki.language.
3  */
4 ( function ( mw, $ ) {
5         /**
6          * @class mw.language
7          */
9         $.extend( mw.language, {
11                 /**
12                  * Get the language fallback chain for current UI language (not including the language itself).
13                  *
14                  * @return {string[]} List of language keys, e.g. `['de', 'en']`
15                  */
16                 getFallbackLanguages: function () {
17                         return mw.language.getData(
18                                 mw.config.get( 'wgUserLanguage' ),
19                                 'fallbackLanguages'
20                         ) || [];
21                 },
23                 /**
24                  * Get the language fallback chain for current UI language, including the language itself.
25                  *
26                  * @return {string[]} List of language keys, e.g. `['pfl', de', 'en']`
27                  */
28                 getFallbackLanguageChain: function () {
29                         return [ mw.config.get( 'wgUserLanguage' ) ]
30                                 .concat( mw.language.getFallbackLanguages() );
31                 }
33         } );
35 }( mediaWiki, jQuery ) );