easyi18n 1.0.1
easyi18n: ^1.0.1 copied to clipboard
Runtime SDK for easyi18n: resolve UI strings with source-as-key tr(), with an offline floor (baked assets) and live hot-update from a delivery manifest/CDN.
Changelog #
1.0.1 #
The code is that of 1.0.0. pub.dev lists
https://github.com/easyi18n-com/dart, which holds the source of the SDK
and the CLI, as its repository and issue tracker.
1.0.0 #
context.trcalled above the app'sLocalizations, as in the widget that buildsMaterialApp(whereflutter createleaves the home page title), now resolves in the locale the app runs in. It used to fall back toen, so that title stayed in English while the rest of the screen showed the translation. The scope reads the locale of the topmostLocalizationsunder it after the frame; until that first read, it uses the device locales resolved againstEasyi18nScope.localesOf, which is whatMaterialApppicks by default. AtrbelowMaterialAppand'src'.tr()resolve as before. (#2472)- That
context.tralso follows a language switch made inside the app when nothing rebuilds the widget that called it, such as a title computed above the widget that holds the locale and buildsMaterialApp. It used to keep the language the app had before the switch. Once atraboveLocalizationshas built, the scope reads the app's locale after every frame and rebuilds the readers above only when it changed. (#2491) - A language the scope does not declare, such as the device's language
under the
Easyi18nScopethatsetupwrites, now shows the latest publish after the app restarts. It used to keep the previous publish until the next one: the startup refresh saved the new manifest etag beside that language's old pointer, and every later check got a 304. The persisted state now keeps the manifest its etag validates (DeliveryState.manifest), a 304 is decided against it, and without it the SDK sends noIf-None-Match, so a device 0.2.0 left in that state shows the latest publish on its first launch. A customBundleStorethat persists the state field by field should storemanifesttoo; without it every launch fetches the whole manifest. On a 304,RefreshResult.localesnow lists the stored manifest's locales andRefreshResult.projectis its id, so aworkspace/slugscope learns its capture endpoint on a launch whose manifest did not change. (#2490) - An exact-number plural case (
=N) past the range of anintno longer throws while a message is canonicalised. (#1923)
0.2.0 #
Easyi18nScope.localesOf(context): the locales the app can offer, asLocales, forMaterialApp.supportedLocales. It is the scope's declared list plus every locale the delivery manifest advertises, and it registers the caller on the scope's notifier, so publishing a new language reachesMaterialAppwithout a rebuild of the app's code.localeFromTagparses a delivery tag (pt-br,zh-hant,es-419) with Flutter's subtag casing. This is whateasyi18n init0.13 wires; an app that hardcodessupportedLocaleskeeps working.- The scope and
Easyi18nController.createclose thehttp.Clientthey built when disposed; an injected client is left open. Before this every unmounted scope kept a socket and the 15 s idle timerdart:ioarms with it. (#1545, #1660, #1689)
0.1.1 #
No behaviour change for an app already on 0.1.0. The resolver, the ICU
canonicaliser and the bundle hashing are byte-identical, and the public API is
unchanged. This release re-syncs the vendored contract with easyi18n_core.
- The vendored CLDR plural table is now generated from Unicode's own cardinal
plural rules instead of hand-listed, and its lookup honours a region before
falling back to the language subtag (CLDR states
pt-PTseparately frompt). The SDK never reads this table itself — it is vendored for consumers outside this repo, and a delivered bundle carries rendered ICU rather than form maps — so nothing an app renders moves. (#486, #491, #496) - Golden contract vectors extended: the served and parsed ICU plural recipes, the three previously unvectored recipes, adversarial cross-SDK cases, and key order where UTF-16 and code point ordering disagree. (#326, #455, #486)
0.1.0 #
- Initial runtime SDK:
Easyi18nScope+context.tr(source, args:)/'source'.tr()source-as-key resolution. - Offline floor from baked assets (
assets/easyi18n/{locale}.json). - Automatic hot-update from a delivery manifest (conditional
If-None-Match, content-addressed immutable bundles, atomic swap with rebuild). - Vendored, byte-parity contract (token + bundle hashing) gated by golden
vectors and
tool/sync_contract.dart.