Closed raindy29 closed 4 years ago
You can use it the same way is used in an app. You initialize the delegate during the app startup as shown in https://github.com/bratan/flutter_translate/wiki/1.-Installation,-Configuration-&-Usage and then can use the translate or changeLocale method within the package.
I set the basepath of the package,But it affects the main() parameters
` void main() async { initializeReflectable(); // Imported from main.reflectable.dart
var delegate = await LocalizationDelegate.create( preferences: TranslatePreferences(), fallbackLocale: 'en_US', basePath: 'assets/i18n/', supportedLocales: ['en_US', 'zh_TW', 'ja_jp']);
runApp(LocalizedApp(delegate, App())); } `
my packages
delegate = await LocalizationDelegate.create( preferences: TranslatePreferences(), fallbackLocale: localizationDelegate.currentLocale.toString(), basePath: 'packages/myproj/assets/i18n/', supportedLocales: ['en_US', 'zh_TW', 'ja_jp']);
Can you give me an example, Other package is already used ?