getx_multilanguage_helper

Last updated:

0 purchases

getx_multilanguage_helper Image
getx_multilanguage_helper Images
Add to Cart

Description:

getx multilanguage helper

Getx Multilanguage Helper #
This Flutter package provides a convenient way to manage multilanguage support in your Flutter applications using the GetX state management library. It includes controllers, translations, and configuration classes to streamline the implementation of multilanguage features.
Buy Me A Coffee ☕️ #

Installation #
Add the following dependency to your pubspec.yaml file:
dependencies:
getx_multilanguage_helper: ^version_number
copied to clipboard
Usage #
Adding Language JSON Files #
Place language-specific JSON files in the specified translation path (assets/languages/). For example, create en.json and tr.json files for English and Turkish translations, respectively.
en.json:
{
"app_title": "My App",
"welcome_message": "Welcome to My App!",
// Add more key-value pairs for English translations...
}
copied to clipboard
### Initialize GetxMultilanguageHelperController
In your main.dart file, initialize the GetxMultilanguageHelperController with the desired configuration. You can specify the translation path, supported languages, default locale, and fallback locale.
void main() async {
await Get.putAsync(
() async => await GetxMultilanguageHelperController().init(
config: GetxMultilanguageHelperConfiguration(
translationPath: 'assets/languages/',
languages: [
LanguageModel(title: 'en'.tr, localeKey: 'en_EN'),
LanguageModel(title: 'tr'.tr, localeKey: 'tr_TR'),
LanguageModel(title: 'de'.tr, localeKey: 'de_DE'),
// Add more languages as needed...
],
defaultLocale: const Locale('en', 'EN'),
fallbackLocale: const Locale('de', 'DE'),
),
),
);
runApp(const Main());
}
copied to clipboard
Configure GetMaterialApp #
In your main widget, configure the GetMaterialApp with the GetxMultilanguageHelperTranslation for translations, default locale, and fallback locale.
class Main extends StatelessWidget {
const Main({Key? key}) : super(key: key);

@override
Widget build(BuildContext context) {
return GetMaterialApp(
translations: GetxMultilanguageHelperTranslation(),
locale: GetxMultilanguageHelperTranslation.defaultLocale,
fallbackLocale: GetxMultilanguageHelperTranslation.fallbackLocale,
// Add other configurations as needed...
);
}
}
copied to clipboard

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.