Skip to content
pubscout

i18n

4.2.6, released 6 months ago by muha.dev

Simple i18n solution using YAML files to generate compile-safe Dart translation classes.

WASM-ready
$ flutter pub add i18n
Source repository

What it does

Allows writing messages into YAML files and uses build_runner to generate convenient, compile-safe Dart classes with support for parameters and pluralization.

AI-written summary of version 4.2.6, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You want compile-time safety for your localization keys
  • You prefer calling methods instead of arbitrary strings for translations
  • You already use build_runner in your project

Skip it when

  • You prefer zero code generation and dynamic runtime loading
  • You want a fully-featured localization suite without writing custom plurals for unsupported languages

Strengths

  • Compile-time safety and autocomplete support
  • Leverages standard Dart string interpolation
  • Supports pluralization and cardinal/ordinal rules

Weaknesses

  • Requires build_runner and code generation steps
  • Built-in plural rules are currently limited to English and Czech unless custom rules are added

Setup

Kind
Pure Dart
Effort
Low
Code generation
Yes (build_runner)
Direct dependencies
7

Add build_runner as a dev_dependency and i18n as a dependency, then run the build_runner watch command.

Messages m = Messages();
print(m.users.welcome('World'));

Alternatives

Packages that do the same job and could replace i18n.

  • intl

    Official internationalization package with extensive locale and date/number formatting support.

  • easy_localization

    Supports easy translation loading from JSON, YAML, CSV files without strict code generation.

  • slang

    Another strong type-safe localization package using code generation with rich features.

Works with

Packages commonly used together with i18n: ones it builds on, ones built on it, and its own family.