df_localization 0.6.0
df_localization: ^0.6.0 copied to clipboard
A package that simplifies adding localization to your Flutter app.
Changelog #
0.6.0 #
- breaking: Remove
ClaudeTranslatorBroker,GeminiTranslatorBroker,OpenAITranslatorBroker— replaced by the unifiedLlmTranslatorBrokerwith.claude()/.gemini()/.openai()factory constructors that drive anyAiBrokerfromai_broker. - breaking: Rename the
gen-translations-geminiCLI togen-translations. Adds a--provider claude|gemini|openaiflag and drops thegoogle_generative_aidependency in favour ofai_broker. - breaking: Bump
df_configto^0.8.0. Code that previously assignedTranslationManager.config = ...must switch toawait TranslationManager.setConfig(...). - feat: Add
RemoteTranslationControllerfor apps where translations are fetched from a backend via a singleFuture<Map<String, String>> Function(Locale)callback. Includes built-in stale-load protection for rapid locale switches. - feat: Add
.trIcu({args, preferKey, locale})extension — full ICU MessageFormat support (plural, select, gender,selectordinal) with CLDR rules per locale, backed byintl'sMessageFormat. - feat: Add
getSystemLocale()/getSystemLocales()/bestLocale(supported, {preferred})— cross-platform locale helpers (iOS, Android, macOS, Windows, Linux, Web).bestLocaleis a drop-in forMaterialApp.localeListResolutionCallback. - feat: Add
isRtlLocale(locale)/getTextDirection(locale)helpers for right-to-left languages. - feat: Add
ActiveLocale— process-wide active locale read by.trIcu()for plural rules and updated automatically by every controller'ssetLocale. - fix:
AutoTranslationControllerno longer poisons the new-locale cache or DB path when the user switches locale mid-translation. - fix: First auto-translation against an empty remote database no longer crashes with
Cannot modify unmodifiable map. - fix:
TranslationController.setLocalenow awaits the file read so.tr()calls fired immediately after are guaranteed to see the new translations. - fix:
TranslationController.createInstanceaccepts thefileTypeparameter documented in the README.