init static method

void init({
  1. required Locale defaultLocale,
  2. List<Locale>? otherLocales,
  3. String customPath = "",
})

Initialize Localization (i18n) implementation

Implementation

static void init(
    {required Locale defaultLocale,
    List<Locale>? otherLocales,
    String customPath = ""}) {
  List<Locale> supportedLocales = [];
  supportedLocales.add(defaultLocale);
  if (otherLocales != null && otherLocales.length > 0)
    supportedLocales.addAll(otherLocales);
  TGLocale.supportedLocales = supportedLocales;
  TGLocale.defaultLocale = defaultLocale;
  TGLocale.currentLocale = defaultLocale;
  TGLocale.customPath = customPath;
  loadLocales();
}