mirror of
https://github.com/flarum/core.git
synced 2025-07-20 00:01:17 +02:00
feat(translator): add locale getter (#3451)
This commit is contained in:
@@ -18,10 +18,20 @@ export default class Translator {
|
|||||||
*/
|
*/
|
||||||
protected formatter = new RichMessageFormatter(null, this.formatterTypeHandlers(), mithrilRichHandler);
|
protected formatter = new RichMessageFormatter(null, this.formatterTypeHandlers(), mithrilRichHandler);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the formatter's locale to the provided value.
|
||||||
|
*/
|
||||||
setLocale(locale: string) {
|
setLocale(locale: string) {
|
||||||
this.formatter.locale = locale;
|
this.formatter.locale = locale;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the formatter's current locale.
|
||||||
|
*/
|
||||||
|
getLocale() {
|
||||||
|
return this.formatter.locale;
|
||||||
|
}
|
||||||
|
|
||||||
addTranslations(translations: Translations) {
|
addTranslations(translations: Translations) {
|
||||||
Object.assign(this.translations, translations);
|
Object.assign(this.translations, translations);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user