dartpub.dev DartNative · beta
plugins / dartnative_intl
di

dartnative_intl

v1.0.0 dartpub Free

ARB localisation code generator

The DartNative localisation code generator — a drop-in replacement for `intl_utils` that turns ARB files into pure-DartNative l10n code (`S.of(context)`, `S.delegate`) using the same `flutter_intl:` config. One command, no external SDK.

by DartNative/dartnative_intl · DartNative ≥ 3.0 · updated 1 month ago
Install
Free
pubspec.yaml
dependencies:
  dartnative_intl: ^1.0.0
Weekly installs
38
Active apps
3
Rating
0.0 · 0
Open issues
0

dartnative_intl

ARB-to-Dart localisation code generator for DartNative apps — a drop-in replacement for intl_utils. One command, same config, generated code that's pure DartNative.

Why you'll like it

  • Pure DartNative output — generated files import dartnative; your l10n layer has no external SDK dependency.
  • Same config — the flutter_intl: block in pubspec.yaml works exactly as with intl_utils; nothing to learn.
  • Same generated APIS.of(context), S.delegate, and S.supportedLocales are identical; existing app code needs no changes beyond swapping the dependency.
  • Familiardart run dartnative_intl:generate, like intl_utils.

Highlights

  • dart run dartnative_intl:generate — reads your ARB files and generates the full l10n class tree.
  • Locale, LocalizationsDelegate, Localizations — pure-Dart runtime shims included so generated code compiles with no extra dependencies.
  • Localizely support — optional download step pulls ARBs from Localizely before generating (same as upstream).

Install

dependencies:
  dartnative_intl: ^1.0.0   # from dartpub.dev
dn pub get

Configure in pubspec.yaml (same keys as intl_utils):

flutter_intl:
  enabled: true
  arb_dir: lib/l10n
  output_dir: lib/generated
  main_locale: en

Quick look

Add your ARB files:

lib/l10n/intl_en.arb
lib/l10n/intl_pt.arb

Run the generator:

dart run dartnative_intl:generate

Use the generated class in your app:

import 'package:dartnative_intl/dartnative_intl.dart';

// Register the resolver once at startup
Localizations.setResolver(<T>(context) => /* your dartnative lookup */);

// Then anywhere in your widget tree
final label = S.of(context).welcomeMessage;

Wire up the delegate (identical to intl_utils):

localizationsDelegates: [
  S.delegate,
  ...
],
supportedLocales: S.supportedLocales,

Credits & license

Adapted from intl_utils (MIT), reworked to use DartNative imports.

Distributed via dartpub.dev — file issues on the plugin's page.