flutter_i18n
0.37.1, released 11 months ago by an unverified publisher
I18n made easy for Flutter using JSON, XML, YAML or TOML files.
What it does
Simplifies the internationalization process in Flutter apps by allowing translations to be loaded from local files or network sources in formats like JSON, YAML, TOML, and XML. Supports runtime locale changes, plurals, and missing translation handlers.
AI-written summary of version 0.37.1, based on the package's README and metadata. Report an inaccuracy
Use it when
- You want to manage translations using simple JSON, YAML, TOML or XML files
- You need runtime language switching and pluralization support
- You want support for loading translation files from the network or device storage
Skip it when
- You prefer type-safe generated translation keys (codegen approach)
- You need a different localization format not supported by the loaders
Strengths
- Supports multiple file formats (JSON, YAML, TOML, XML)
- Offers various loaders including local, network, and namespace-based loaders
- Provides built-in widgets like I18nText and I18nPlural for convenience
Weaknesses
- No code generation for compile-time key safety
- Requires manual setup of assets in pubspec.yaml
Setup
- Kind
- Flutter widgets
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 10
Configure assets folder in pubspec.yaml and add FlutterI18nDelegate to localizationsDelegates.
MaterialApp(
localizationsDelegates: [
FlutterI18nDelegate(
translationLoader: FileTranslationLoader(
basePath: 'assets/i18n',
useCountryCode: false,
),
),
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate
],
)Alternatives
Packages that do the same job and could replace flutter_i18n.
- easy_localization
Another popular easy localization package supporting JSON, CSV, and YAML.
64Compare - slang
Provides type-safe translations through code generation.
90Compare
Works with
Packages commonly used together with flutter_i18n: ones it builds on, ones built on it, and its own family.
- yamlflutter_i18n depends on itA Dart library for parsing YAML documents into Dart data structures.
- webflutter_i18n depends on itLightweight bindings for browser APIs via JS interop
- intlflutter_i18n depends on itA Dart library for internationalization and localization, providing message translation, plural/gender handling, and date/number formatting.
- loggingflutter_i18n depends on itProvides configurable logging with levels and stream listeners for Dart apps.
- rxdartflutter_i18n depends on itImplementation of the ReactiveX API for asynchronous programming leveraging native Dart Streams.
- tomlflutter_i18n depends on itParse and encode TOML configuration files in Dart.