ApiSandbox: Visual separation of fields
[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).
14 * @return {string[]} List of language keys, e.g. `['de', 'en']`
16 getFallbackLanguages: function () {
17 return mw.language.getData(
18 mw.config.get( 'wgUserLanguage' ),
19 'fallbackLanguages'
20 ) || [];
23 /**
24 * Get the language fallback chain for current UI language, including the language itself.
26 * @return {string[]} List of language keys, e.g. `['pfl', de', 'en']`
28 getFallbackLanguageChain: function () {
29 return [ mw.config.get( 'wgUserLanguage' ) ]
30 .concat( mw.language.getFallbackLanguages() );
33 } );
35 }( mediaWiki, jQuery ) );