fluent
2.0.4, released 4 months ago by ryanhu.online
Dart implementation of Project Fluent for natural language localization.
What it does
Fluent is a Dart runtime implementation of Project Fluent, a localization framework designed to handle complex natural language concepts like plurals, gender, and conjugations. It uses FTL translation files and provides the FluentBundle class to format localized messages with arguments.
AI-written summary of version 2.0.4, based on the package's README and metadata. Report an inaccuracy
Use it when
- You want to use Project Fluent (FTL) localization files in your Dart or Flutter application.
- You need advanced localization features like gender, plurals, and complex natural language formatting.
Skip it when
- You prefer standard Flutter arb/l10n localization approaches.
- You need full support for all advanced DATETIME and NUMBER options which are currently not supported.
Strengths
- Unleashes the expressive power of natural language translations through FTL files.
- Supports custom functions for localized variations (e.g., OS-based text).
- Recovers gracefully from formatting errors to provide human-readable fallbacks.
Weaknesses
- Does not yet support certain advanced options for NUMBER and DATETIME formatting.
- Requires manual parsing and setup of FTL files.
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 1
Not documented
final bundle = FluentBundle('en-GB');
bundle.addMessages('''
welcome = Welcome to this great app!
greet-by-name = Hello, { $name }!
''');
List<Error> errors = [];
final translated = bundle.format('greet-by-name', args: {'name': 'Jane'}, errors: errors);Alternatives
Packages that do the same job and could replace fluent.
- flutter_intl
A package for internationalization that is currently in the planning stage.
40Compare - l10n_languages
Provides CLDR-like translations for language names across 157 locales.
80Compare - gettext
Platform agnostic gettext localization framework for Dart and Flutter
41Compare - flutter_locales
Easily localize Flutter apps using JSON files with dynamic locale switching and persistent storage.
51Compare
Works with
Packages commonly used together with fluent: ones it builds on, ones built on it, and its own family.