Flutter ICU compatible Localization library with support for JSONs, runtime parsing and injecting
- ICU compatible
- parsing JSONs
- runtime parsing and injecting of localizations
flutter pub add im_localized
Or add to your pubspec.yaml
:
dependencies:
im_localized: <last_version>
Checkout example/lib/main.dart for complete example.
void main() async {
runApp(
ImLocalizedApp.fromList(
/// initial translations loaded from RAM
initialTranslations: initialTranslations,
/// save locale changes to local storage
// localeStorage: SharedPreferencesLocaleStorage(),
/// save injected translations to local storage
// translationsStorage: SharedPreferencesTranslationsStorage(),
app: const MyApp(),
),
);
}
- Create at least one localization file (i.e. lib/l10n/en.json)
- run generate script
flutter pub run im_localized:generate
This library uses source code from the following projects:
- easy_localization by github.com/aissat/
- flutter_tools from the Flutter team
Work in progress