A lightweight modular library for internationalization (i18n) functionality.
- Formatting for dates, numbers, and lists.
- Collation.
- Display names.
We're actively iterating on the API for this package (please provide feedback via our issue tracker).
Number format | List format | Date format | Collation | Display names | Plural Rules | |
---|---|---|---|---|---|---|
ECMA402 (web) | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ |
ICU4X (web/native) | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ |
- Wraps around ICU4X on native or web platforms.
- Wraps around the built-in browser functionalities on the web.
- Select which locales you want to use the browser for through an
EcmaPolicy
.
- Select which locales you want to use the browser for through an
The functionalities are called through getters on an Intl
instance, i.e.
import 'package:intl4x/ecma_policy.dart';
import 'package:intl4x/intl4x.dart';
import 'package:intl4x/number_format.dart';
void main() {
final numberFormat = Intl(
ecmaPolicy: const AlwaysEcma(),
locale: const Locale(language: 'en', region: 'US'),
).numberFormat(NumberFormatOptions.percent());
print(numberFormat.format(0.5)); // prints 50%
}