Adding a special region
This is supposed to allow adding special languages. This region's section is hidden by default and can be enabled by passing different options to the lcd object.
This commit is contained in:
@@ -417,4 +417,36 @@
|
||||
return $.uls.data.territories[territory];
|
||||
};
|
||||
|
||||
/**
|
||||
* Adds a language in run time and sets its options as provided.
|
||||
* If the target option is provided, the language is defined as a redirect.
|
||||
* Other possible options are script, regions and autonym.
|
||||
*
|
||||
* @param code string New language code.
|
||||
* @param options Object Language properties.
|
||||
* @return list of language codes
|
||||
*/
|
||||
$.uls.data.addLanguage = function( code, options ) {
|
||||
if ( options.target ) {
|
||||
$.uls.data.languages[code] = [options.target];
|
||||
} else {
|
||||
$.uls.data.languages[code] = [options.script, options.regions, options.autonym];
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Removes a language from the langdb in run time.
|
||||
*
|
||||
* @param code string Language code to delete.
|
||||
* @return true if the language was removed, false otherwise.
|
||||
*/
|
||||
$.uls.data.deleteLanguage = function( code ) {
|
||||
if ( $.uls.data.languages[code] ) {
|
||||
delete $.uls.data.languages[code];
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
} ( jQuery ) );
|
||||
|
||||
Reference in New Issue
Block a user