1
0
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:
David Wheatley
2022-06-20 03:51:26 +01:00
committed by GitHub
parent 5dedec12f9
commit cb47a9c92e

View File

@@ -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);
}