diff --git a/slang/README.md b/slang/README.md index 83c1b6d..0e8fa76 100644 --- a/slang/README.md +++ b/slang/README.md @@ -1156,7 +1156,7 @@ LocaleSettings.overrideTranslations( content: r''' onboarding title: 'Welcome {name}' - ''' + ''', ); // access @@ -1170,6 +1170,21 @@ A few remarks: 3. New translations will be parsed but have no effect. 4. New parameters stay unparsed. (i.e. `{name}` stays `{name}`) +If you use dependency injection, then you can create a new overridden instance using `AppLocaleUtils`: + +```dart +Translations t2 = AppLocaleUtils.buildWithOverridesSync( + locale: AppLocale.en, + fileType: FileType.yaml, + content: r''' +onboarding + title: 'Welcome {name}' + ''', +); + +String a = t2.onboarding.title(name: 'Tom'); // "Welcome Tom" +``` + ### ➤ Dependency Injection You don't like the included `LocaleSettings` solution?