messages_all.dart 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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_fr.dart' as messages_fr;
  16. import 'messages_ja.dart' as messages_ja;
  17. import 'messages_ko.dart' as messages_ko;
  18. import 'messages_ru.dart' as messages_ru;
  19. import 'messages_zh.dart' as messages_zh;
  20. typedef Future<dynamic> LibraryLoader();
  21. Map<String, LibraryLoader> _deferredLibraries = {
  22. 'en': () => new Future.value(null),
  23. 'fr': () => new Future.value(null),
  24. 'ja': () => new Future.value(null),
  25. 'ko': () => new Future.value(null),
  26. 'ru': () => new Future.value(null),
  27. 'zh': () => new Future.value(null),
  28. };
  29. MessageLookupByLibrary? _findExact(String localeName) {
  30. switch (localeName) {
  31. case 'en':
  32. return messages_en.messages;
  33. case 'fr':
  34. return messages_fr.messages;
  35. case 'ja':
  36. return messages_ja.messages;
  37. case 'ko':
  38. return messages_ko.messages;
  39. case 'ru':
  40. return messages_ru.messages;
  41. case 'zh':
  42. return messages_zh.messages;
  43. default:
  44. return null;
  45. }
  46. }
  47. /// User programs should call this before using [localeName] for messages.
  48. Future<bool> initializeMessages(String localeName) async {
  49. var availableLocale = Intl.verifiedLocale(
  50. localeName, (locale) => _deferredLibraries[locale] != null,
  51. onFailure: (_) => null);
  52. if (availableLocale == null) {
  53. return new Future.value(false);
  54. }
  55. var lib = _deferredLibraries[availableLocale];
  56. await (lib == null ? new Future.value(false) : lib());
  57. initializeInternalMessageLookup(() => new CompositeMessageLookup());
  58. messageLookup.addLocale(availableLocale, _findGeneratedMessagesFor);
  59. return new Future.value(true);
  60. }
  61. bool _messagesExistFor(String locale) {
  62. try {
  63. return _findExact(locale) != null;
  64. } catch (e) {
  65. return false;
  66. }
  67. }
  68. MessageLookupByLibrary? _findGeneratedMessagesFor(String locale) {
  69. var actualLocale =
  70. Intl.verifiedLocale(locale, _messagesExistFor, onFailure: (_) => null);
  71. if (actualLocale == null) return null;
  72. return _findExact(actualLocale);
  73. }