Skip to main content

ds_i18n 0.2.0 copy "ds_i18n: ^0.2.0" to clipboard
ds_i18n: ^0.2.0 copied to clipboard

Lightweight, JSON-based localization for Flutter. Drop translation files into assets/i18n/, call I18n.t('key'), switch languages at runtime. No codegen.

0.2.0 #

Changed #

  • BREAKING: LocaleChange extension methods (changeToFirstLocale, changeToNextLocale, changeToLocale) now return Future<void> instead of void, so callers can await the locale switch and the reloaded translations. Fire-and-forget call sites keep working; only tear-offs typed as void Function() need updating.

Added #

  • init() gained an optional force parameter to force a full re-initialization (e.g. in tests).

Fixed #

  • init() now validates initialLocale against the supported locales and falls back to the default locale instead of reporting an unsupported locale.
  • init() is now idempotent and concurrency-safe: the load runs only once, and concurrent or repeated calls await the same in-flight result.
  • I18nConfig.fromJson no longer discards the entire configuration when a single field is missing or malformed; fields are parsed defensively, and defaultLocale/fallbackLocale are validated against supportedLocales.
  • Argument substitution now resolves each placeholder exactly once in a single pass, so inserted values are never re-scanned and unknown placeholders are left intact.
  • ds_i18n:init scaffolding now reports created, overwritten, and skipped files separately instead of conflating them.
  • ds_i18n:init no longer reports a false "already registered" when assets/i18n appears only in a commented-out line of pubspec.yaml.

0.1.0 #

  • Renamed package from i18n to ds_i18n. The import is now package:ds_i18n/ds_i18n.dart. The public API is unchanged — you still call I18n.t('key').
  • BREAKING (config): the config key supportedLocals was renamed to the correctly spelled supportedLocales. Update your assets/i18n/config.json accordingly.
  • Restructured into a single public barrel (lib/ds_i18n.dart) with the implementation moved under lib/src/.
  • Fixed: config parsing crashed because fromJson read the misspelled key fallbacklocale instead of fallbackLocale.
  • Fixed: translate() threw a runtime type error when a non-String argument (e.g. an int count) was passed via args. Values are now converted with toString().
  • Fixed: the configured fallbackLocale was ignored — the translation fallback was hard-coded to en.json. It now uses the configured fallback.
  • Raised minimum Flutter constraint to >=3.35.1.
  • Relicensed from GPL-3.0 to BSD-3-Clause.
  • Added dart run ds_i18n:init to scaffold assets/i18n/ base files in a consuming project.
  • Added a runnable example/ app.

0.0.1 #

  • Initial release: JSON-based localization with runtime locale switching, nested keys, argument substitution, RTL detection, and persistence via shared_preferences.
0
likes
160
points
51
downloads

Documentation

API reference

Publisher

verified publisherdragon-software.net

Weekly Downloads

Lightweight, JSON-based localization for Flutter. Drop translation files into assets/i18n/, call I18n.t('key'), switch languages at runtime. No codegen.

Repository (GitHub)
View/report issues

Topics

#i18n #l10n #localization #translation

License

BSD-3-Clause (license)

Dependencies

flutter, shared_preferences

More

Packages that depend on ds_i18n