i18n: Add method to check for existing language

This commit is contained in:
Michael Fabian 'Xaymar' Dirks
2018-11-29 01:19:21 +01:00
committed by Michael Fabian Dirks
parent 9c8e7e1aab
commit c296e7cc6b
+10
View File
@@ -265,6 +265,16 @@ class I18n {
return chain;
}
/** Check if a language is known.
*
* @param {string} language Name of the language
* @returns {bool} true if known.
*/
hasLanguage(language) {
language = this._sanitizeLanguage(language);
return this.languages.has(language);
}
/** Create a new language.
*
* @param {string} language Name of the language.