intl
0.20.3, released 5 months ago by dart.dev
A Dart library for internationalization and localization, providing message translation, plural/gender handling, and date/number formatting.
What it does
It supplies core i18n utilities such as Intl, DateFormat, NumberFormat, and BidiFormatter. The library supports locale-aware formatting, message extraction, and runtime locale switching.
AI-written summary of version 0.20.3, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to format dates, numbers, or currencies for multiple locales.
- You require message translation with plural and gender support.
- You want to change the app locale at runtime or per operation.
Skip it when
- You only need basic string formatting without locale awareness.
- You prefer a lightweight solution without async initialization.
Strengths
- Comprehensive locale support via CLDR v48.
- Async initialization keeps bundle size small.
- Built-in plural, gender, and bidi handling.
- Supports web, mobile, and desktop platforms.
Weaknesses
- Requires async init for locale data.
- Large dependency on CLDR data can increase bundle size if many locales used.
- No code generation; messages must be manually extracted.
Setup
- Kind
- Pure Dart
- Effort
- Medium
- Code generation
- No
- Direct dependencies
- 3
Call `initializeDateFormatting()` and `initializeMessages()` asynchronously before using formatting. No build_runner needed.
```dart
import 'package:intl/intl.dart';
void main() {
Intl.defaultLocale = 'fr';
var formatter = DateFormat.yMd('fr');
print(formatter.format(DateTime.now()));
}
```Alternatives
Packages that do the same job and could replace intl.
- intl4x
A lightweight Dart library for locale‑sensitive formatting, collation, and plural rules.
80Compare - flutter_libphonenumber
Synchronous and asynchronous phone number formatting and parsing in Flutter apps.
76Compare - i69n
Simple internationalization tool based on YAML files and Dart source code generation.
68Compare - numeral
Composable number formatting and parsing for decimals, compact values, percentages, and locales.
67Compare
Works with
Packages commonly used together with intl: ones it builds on, ones built on it, and its own family.
- clockintl depends on itA fakeable wrapper for dart:core clock APIs.
- built_valueSame familyImmutable value types with builders, enum classes and JSON serialization for Dart.
- platformSame familyCross‑platform abstraction for querying runtime platform info in Dart.
- asyncSame familyUtility classes and helpers that extend Dart's async library.
- httpSame familyA composable, Future‑based library for making HTTP requests across platforms.
- testSame familyA full featured library for writing and running Dart tests across platforms.
- matcherSame familySupport for specifying test expectations via an extensible Matcher class.
- jniSame familyProvides Dart/Flutter bindings to call native Java code via JNI.