Search packages, repositories and app categories

Package detailsv6.0.0

i18n_extension_core

Dart-only package for Translation and Internationalization (i18n), with Dart extensions. Easy to use for both large and small projects.

AndroidiOSLinuxmacOSWebWindows
30-day downloads
68.8K
Likes
5
Pub points
140

Install package

flutter pub add i18n_extension_core

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

A Dart-only package for simplifying translation and internationalization in Flutter apps. It provides intuitive Dart extensions to make localization easy, with minimal boilerplate. Designed for both small and large projects, it supports multiple platforms including Android, iOS, Web, and desktop. The package enables developers to manage translations efficiently using simple syntax and structured key-value pairs, enhancing readability and maintainability of localized strings.

Use cases

  • Simple app localization
  • Large-scale multilingual applications
  • Cross-platform Flutter apps
  • Dynamic string formatting
  • Easy integration with existing codebases
  • Rapid prototyping with translations

Key features

  • Dart extensions for concise syntax
  • Minimal setup and boilerplate
  • Supports platform-agnostic translation
  • Built-in string interpolation
  • Extensible key-value translation system
  • Lightweight and fast

Suitable for

  • Flutter developers new to i18n
  • Teams managing multiple languages
  • Projects requiring quick localization
  • Developers preferring pure Dart solutions
  • Apps targeting global audiences
  • Small to enterprise-level apps

Considerations

  • No built-in UI for translation management
  • Requires manual translation file maintenance
  • Limited IDE support compared to full frameworks
  • Not suitable for runtime language switching without additional logic
  • Does not include translation file generation tools
  • Best used with a consistent naming convention for keys

Original README

Original README snapshot from the linked source repository. Visit the repository for the latest content.

pub package

i18n_extension_core

This is the core Dart-only package for the i18n_extension package.

In your Flutter app:

  • Do NOT include this core package directly.

    Instead, go to the i18n_extension package which already exports this core code, plus provides Flutter related code like the I18n widget that you must use to wrap your widget tree.

In your Dart server or Dart-only code:

  • If you are working on a Dart server-side application (backend) using frameworks such as Serverpod, Dart Frog, or Shelf, or developing a Dart-only package that does not rely on Flutter, you can use this package directly.:

    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);
    }
    
    DefaultLocale.set("es_ES");
    expect("Hello".i18n, "Hola");
    

    Note: One key use case is translating exception messages from the backend to the frontend. For example, if the backend throws an exception like: MyException('The password you typed is invalid'.i18n) it will automatically appear on the frontend as: MyException('La contraseña que ingresaste no es válida') if the user's device language is set to Spanish.

Documentation

Go to i18n_extension to read the docs.

There are only 2 differences when using this package directly:

  • Here you don't have access to the I18n widget, which is a Flutter widget.

  • The way to set the default locale is different. Instead of using the I18n widget, you must use the DefaultLocale.set() static method, like in the example above.


By Marcelo Glasberg

glasberg.dev
github.com/marcglasberg
linkedin.com/in/marcglasberg/
twitter.com/glasbergmarcelo
stackoverflow.com/users/3411681/marcg
medium.com/@marcglasberg

My article in the official Flutter documentation:

The Flutter packages I've authored:

My Medium Articles:

Categories

Dependencies

Dependency list 1 items

Source repository

Projects using this package

Rankings