Repolode
slang-i18n

slang-i18n/slang

Type-safe internationalization library for Dart and Flutter that generates translation accessors from JSON, YAML, CSV, or ARB files.

Stars
619
Forks
66
Open issues
41
Last commit
3 months ago

What is it?

Slang is an internationalization library for Dart and Flutter. You write translations in JSON, YAML, CSV, or ARB files, and it generates Dart code so each translation is accessed as a typed method or property. Missing keys and wrong parameter names are caught at compile time rather than appearing as runtime errors.

The generated accessors avoid runtime parsing of translation files. Strings with parameters, pluralization, custom enum-based contexts, linked translations, RichText spans, and locale-aware number and date formatting are supported. Namespaces split large translation files into smaller ones, and the library works in pure Dart projects as well as Flutter apps.

The package includes a command-line tool for analyzing unused or missing translations, normalizing files, moving keys, migrating ARB files to JSON, and updating iOS locale configuration.

Key features

  • 01Generates typed Dart accessors so typos and missing arguments fail at compile time.
  • 02Reads translations from JSON, YAML, CSV, or ARB files.
  • 03Supports pluralization, custom contexts, typed parameters, and RichText.
  • 04Formats numbers and dates according to locale using the intl package.
  • 05Includes a CLI for analyzing, normalizing, and migrating translation files.

Use cases

  • Adding multilingual support to a Flutter app with compile-time-checked strings.
  • Localizing a pure Dart command-line tool or server application.
  • Migrating an existing ARB-based Flutter project to a JSON or YAML workflow.
  • Detecting unused or missing translations in a large multi-locale project.

Quick start

  1. 1

    Add the slang and slang_flutter packages to pubspec.yaml

  2. 2

    Create JSON translation files such as en.i18n.json in lib/i18n

  3. 3

    Generate the Dart translation code

    dart run slang
  4. 4

    Initialize the locale in main() and use translations via t

Things to know

  • Requires a Dart or Flutter project; it is not usable from other languages.

Topics

FAQ

What is slang?
Type-safe internationalization library for Dart and Flutter that generates translation accessors from JSON, YAML, CSV, or ARB files. Slang is an internationalization library for Dart and Flutter. You write translations in JSON, YAML, CSV, or ARB files, and it generates Dart code so each translation is accessed as a typed method or property. Missing keys and wrong parameter names are caught at compile time rather than appearing as runtime errors.
Is slang free to use? What license does it have?
slang is open source under the MIT license. Check the license terms before using it in commercial products.
Is slang still maintained?
Updated within 6 months. The last commit to slang was on Aug 6, 2026.
What can I use slang for?
Adding multilingual support to a Flutter app with compile-time-checked strings. Localizing a pure Dart command-line tool or server application. Migrating an existing ARB-based Flutter project to a JSON or YAML workflow. Detecting unused or missing translations in a large multi-locale project.
How do I install slang?
Add the slang and slang_flutter packages to pubspec.yaml Create JSON translation files such as en.i18n.json in lib/i18n Generate the Dart translation code: dart run slang Initialize the locale in main() and use translations via t
Where can I get slang?
The source code and installation instructions are on GitHub: https://github.com/slang-i18n/slang

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects