init static method

Future<void> init({
  1. required String defaultLangCode,
  2. String? path,
  3. bool? isDebug,
})

Initializes the translation system with the specified default language code.

defaultLangCode is the fallback language code if the system's language file isn't available. path is the custom path for the localization files (optional). /// isDebug enables or disables debug mode (optional).

Implementation

static Future<void> init({
  required String defaultLangCode,
  String? path,
  bool? isDebug,
}) async {
  _defaultLangCode = defaultLangCode;
  _localizationPath = path ?? _localizationPath;
  _isDebug = isDebug ?? _isDebug;
  _langCode = _getLangCode();
  String jsonString = await _getJsonString();

  json = {};
  json.addAll(jsonDecode(jsonString));
}