Reputation: 2524
Using intl package how can I initialize multiple libraries. For example I have some translation on lib1
and other on lib2
, I would like to initialize both translations so they can be used in my code. Until the moment I have this:
import 'package:lib1/_l10n/messages_all.dart' as lib1;
import 'package:lib2/_l10n/messages_all.dart' as lib2;
import 'package:intl/intl.dart';
import 'package:mylib/_l10n/messages_all.dart' as mylib;
main() {
intl.defaultLocle = 'es';
await lib1.initializeMessages('es');
await lib2.initializeMessages('es');
await mylib.initializeMessages('es');
print(lib1.helloMessage());
print(lib2.hiMessage());
print(mylib.whatUpMessage());
}
It only translate lib1.helloMessage()
since is the first one, the rest of message keep being shown in english.
Upvotes: 1
Views: 66
Reputation: 2971
That doesn't work right now. You would have to generate a combined library and use that.
Upvotes: 2