flutter_gettext
2.3.0, released 6 months ago by bastianschmalbach.dev
Translate Flutter applications using standard gettext .po files with positional and named arguments.
WASM-ready
What it does
Allows loading standard .po translation files as assets in a Flutter application. Provides translation extension methods with support for plurals, contexts, comments, and both positional and named arguments.
AI-written summary of version 2.3.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You prefer standard gettext (.po) files for managing application translations.
- You need pluralization and positional or named arguments within translated strings.
- You want to avoid code-generation steps for localization files.
Skip it when
- You prefer type-safe generated keys as provided by packages like slang.
- Your project relies heavily on the standard Flutter intl and ARB translation pipeline.
Strengths
- Supports .po translation files compatible with standard gettext translation tools.
- Supports positional arguments, named arguments, and plurals out of the box.
- No code generation step required.
Weaknesses
- Translation keys are plain strings rather than type-safe generated properties.
- Dependent on asset loading for .po files.
Setup
- Kind
- Flutter widgets
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 1
Add the package and flutter_localizations, configure assets/i18n/ in pubspec.yaml, and add GettextLocalizationsDelegate to localizationsDelegates.
Text(context.translate('There is {0} apple', keyPlural: 'There are {0} apples', pArgs: [1]));Alternatives
Packages that do the same job and could replace flutter_gettext.