messages_all.dart 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. // DO NOT EDIT. This is code generated via package:intl/generate_localized.dart
  2. // This is a library that looks up messages for specific locales by
  3. // delegating to the appropriate library.
  4. // Ignore issues from commonly used lints in this file.
  5. // ignore_for_file:implementation_imports, file_names, unnecessary_new
  6. // ignore_for_file:unnecessary_brace_in_string_interps, directives_ordering
  7. // ignore_for_file:argument_type_not_assignable, invalid_assignment
  8. // ignore_for_file:prefer_single_quotes, prefer_generic_function_type_aliases
  9. // ignore_for_file:comment_references
  10. import 'dart:async';
  11. import 'package:intl/intl.dart';
  12. import 'package:intl/message_lookup_by_library.dart';
  13. import 'package:intl/src/intl_helpers.dart';
  14. import 'messages_en.dart' as messages_en;
  15. import 'messages_zh.dart' as messages_zh;
  16. typedef Future<dynamic> LibraryLoader();
  17. Map<String, LibraryLoader> _deferredLibraries = {
  18. 'en': () => new Future.value(null),
  19. 'zh': () => new Future.value(null),
  20. };
  21. MessageLookupByLibrary _findExact(String localeName) {
  22. switch (localeName) {
  23. case 'en':
  24. return messages_en.messages;
  25. case 'zh':
  26. return messages_zh.messages;
  27. default:
  28. return null;
  29. }
  30. }
  31. /// User programs should call this before using [localeName] for messages.
  32. Future<bool> initializeMessages(String localeName) async {
  33. var availableLocale = Intl.verifiedLocale(
  34. localeName,
  35. (locale) => _deferredLibraries[locale] != null,
  36. onFailure: (_) => null);
  37. if (availableLocale == null) {
  38. return new Future.value(false);
  39. }
  40. var lib = _deferredLibraries[availableLocale];
  41. await (lib == null ? new Future.value(false) : lib());
  42. initializeInternalMessageLookup(() => new CompositeMessageLookup());
  43. messageLookup.addLocale(availableLocale, _findGeneratedMessagesFor);
  44. return new Future.value(true);
  45. }
  46. bool _messagesExistFor(String locale) {
  47. try {
  48. return _findExact(locale) != null;
  49. } catch (e) {
  50. return false;
  51. }
  52. }
  53. MessageLookupByLibrary _findGeneratedMessagesFor(String locale) {
  54. var actualLocale = Intl.verifiedLocale(locale, _messagesExistFor,
  55. onFailure: (_) => null);
  56. if (actualLocale == null) return null;
  57. return _findExact(actualLocale);
  58. }