init method
Future<GetxMultilanguageHelperController>
init({
- required GetxMultilanguageHelperConfiguration config,
Initializes the multilanguage helper controller with the provided configuration. Example usage:
GetxMultilanguageHelperController().init('assets/translations/', languages:[LanguageModel(title: 'en'.tr, localeKey: 'en_EN')])
Implementation
Future<GetxMultilanguageHelperController> init({required GetxMultilanguageHelperConfiguration config}) async {
_configuration = config;
if (_configuration.languages.isEmpty) {
throw const GetxMultilanguageException('languages.isEmpty');
}
for (var language in config.languages) {
Map<String, String> json = await _loadJsonData(language.localeKey.split("_").first);
_keys[language.localeKey] = json;
}
return this;
}