Commit d25981cf authored by Dariusz Baciński's avatar Dariusz Baciński Committed by Adam Barth

generate_from_arb has been moved to intl_translantion library (#9255)

* generate_from_arb has been moved to intl_translantion library

* fixed typo

* added missing intl dependency

* Regenerated language files with latest intl script

* Added version to intl_translations

* added isolate min version constraint
parent 610955f8
To rebuild the i18n files: To rebuild the i18n files:
``` ```
pub run intl:generate_from_arb \ pub run intl_translation:generate_from_arb \
--output-dir=lib/i18n \ --output-dir=lib/i18n \
--generated-file-prefix=stock_ \ --generated-file-prefix=stock_ \
--no-use-deferred-loading \ --no-use-deferred-loading \
......
...@@ -29,15 +29,24 @@ MessageLookupByLibrary _findExact(localeName) { ...@@ -29,15 +29,24 @@ MessageLookupByLibrary _findExact(localeName) {
/// User programs should call this before using [localeName] for messages. /// User programs should call this before using [localeName] for messages.
Future initializeMessages(String localeName) { Future initializeMessages(String localeName) {
initializeInternalMessageLookup(() => new CompositeMessageLookup());
var lib = _deferredLibraries[Intl.canonicalizedLocale(localeName)]; var lib = _deferredLibraries[Intl.canonicalizedLocale(localeName)];
var load = lib == null ? new Future.value(false) : lib(); var load = lib == null ? new Future.value(false) : lib();
return load.then((_) => return load.then((_) {
messageLookup.addLocale(localeName, _findGeneratedMessagesFor)); initializeInternalMessageLookup(() => new CompositeMessageLookup());
messageLookup.addLocale(localeName, _findGeneratedMessagesFor);
});
}
bool _messagesExistFor(String locale) {
var messages;
try {
messages = _findExact(locale);
} catch (e) {}
return messages != null;
} }
MessageLookupByLibrary _findGeneratedMessagesFor(locale) { MessageLookupByLibrary _findGeneratedMessagesFor(locale) {
var actualLocale = Intl.verifiedLocale(locale, (x) => _findExact(x) != null, var actualLocale = Intl.verifiedLocale(locale, _messagesExistFor,
onFailure: (_) => null); onFailure: (_) => null);
if (actualLocale == null) return null; if (actualLocale == null) return null;
return _findExact(actualLocale); return _findExact(actualLocale);
......
...@@ -3,7 +3,9 @@ dependencies: ...@@ -3,7 +3,9 @@ dependencies:
flutter: flutter:
sdk: flutter sdk: flutter
intl: '>=0.14.0 <0.15.0' intl: '>=0.14.0 <0.15.0'
intl_translation: '>=0.14.0 <0.15.0'
http: '>=0.11.3+12' http: '>=0.11.3+12'
isolate: '>=1.0.0'
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment