set static method
Implementation
static Future<void> set(Language? lang, {bool refresh = true}) async {
if (lang == chosen.value || lang == null) {
return;
}
if (languages.contains(lang)) {
Intl.defaultLocale = lang.locale.toString();
chosen.value = lang;
_bundle =
FluentBundle(lang.toString())
..addMessages(await rootBundle.loadString('assets/l10n/$lang.ftl'))
..addMessages(
_phrases.entries.map((e) => '${e.key} = ${e.value}').join('\n'),
);
if (refresh) {
await Get.forceAppUpdate();
}
} else {
throw ArgumentError.value(lang);
}
}