i18n_extension_core
6.0.1, released 4 days ago by glasberg.dev
Dart-only i18n library providing string extensions for translation, plural and gender handling.
WASM-ready
What it does
It adds extension methods to String for translating text based on locale maps. Supports pluralization, gender modifiers, and default locale setting without Flutter widgets.
AI-written summary of version 6.0.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need i18n in pure Dart or server-side code
- You want lightweight translation without Flutter dependencies
- You prefer extension‑method API over ARB files
Skip it when
- You need Flutter widget integration like I18n widget
- You rely on code‑generated localization (e.g., intl)
- You need platform‑specific locale detection
Strengths
- Works in any Dart environment (Flutter or server)
- Simple API using extensions
- Supports gender and plural modifiers
- No code generation required
Weaknesses
- No built‑in Flutter widget support
- Limited tooling compared to intl (e.g., IDE extraction)
- Documentation focuses on core usage; Flutter docs are separate
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 1
import 'package:i18n_extension_core/i18n_extension_core.dart';
extension Localization on String {
static var t = Translations.byText('en_us') + {'en_us':'Hello','pt_br':'Hola'};
String get i18n => localize(this, t);
}
void main(){
DefaultLocale.set('pt_br');
print('Hello'.i18n); // Hola
}Alternatives
Packages that do the same job and could replace i18n_extension_core.
Works with
Packages commonly used together with i18n_extension_core: ones it builds on, ones built on it, and its own family.