translate method

void translate(
  1. String languageCode, {
  2. String countryCode = '',
  3. bool save = true,
})

Call this function at where you want to translate the app like by pressing the button or any actions.

Implementation

void translate(
  String languageCode, {
  String countryCode = '',
  bool save = true,
}) {
  if (languageCode == _currentLocale?.languageCode) return;
  if (save) TranslatorUtil.setLocale(languageCode, countryCode);
  _currentLocale = Locale(languageCode, countryCode);
  _delegate = TranslatorDelegate(_currentLocale);
  if (onTranslatedLanguage != null) onTranslatedLanguage!(_currentLocale);
}