mirror of
https://github.com/flarum/core.git
synced 2025-07-19 07:41:22 +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);
|
||||
|
||||
/**
|
||||
* Sets the formatter's locale to the provided value.
|
||||
*/
|
||||
setLocale(locale: string) {
|
||||
this.formatter.locale = locale;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the formatter's current locale.
|
||||
*/
|
||||
getLocale() {
|
||||
return this.formatter.locale;
|
||||
}
|
||||
|
||||
addTranslations(translations: Translations) {
|
||||
Object.assign(this.translations, translations);
|
||||
}
|
||||
|
Reference in New Issue
Block a user