messages_all.dart 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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:flutter/foundation.dart';
  12. import 'package:intl/intl.dart';
  13. import 'package:intl/message_lookup_by_library.dart';
  14. import 'package:intl/src/intl_helpers.dart';
  15. import 'messages_en.dart' as messages_en;
  16. import 'messages_zh_CN.dart' as messages_zh_cn;
  17. import 'messages_zh_HK.dart' as messages_zh_hk;
  18. typedef Future<dynamic> LibraryLoader();
  19. Map<String, LibraryLoader> _deferredLibraries = {
  20. 'en': () => new SynchronousFuture(null),
  21. 'zh_CN': () => new SynchronousFuture(null),
  22. 'zh_HK': () => new SynchronousFuture(null),
  23. };
  24. MessageLookupByLibrary? _findExact(String localeName) {
  25. switch (localeName) {
  26. case 'en':
  27. return messages_en.messages;
  28. case 'zh_CN':
  29. return messages_zh_cn.messages;
  30. case 'zh_HK':
  31. return messages_zh_hk.messages;
  32. default:
  33. return null;
  34. }
  35. }
  36. /// User programs should call this before using [localeName] for messages.
  37. Future<bool> initializeMessages(String localeName) {
  38. var availableLocale = Intl.verifiedLocale(
  39. localeName, (locale) => _deferredLibraries[locale] != null,
  40. onFailure: (_) => null);
  41. if (availableLocale == null) {
  42. return new SynchronousFuture(false);
  43. }
  44. var lib = _deferredLibraries[availableLocale];
  45. lib == null ? new SynchronousFuture(false) : lib();
  46. initializeInternalMessageLookup(() => new CompositeMessageLookup());
  47. messageLookup.addLocale(availableLocale, _findGeneratedMessagesFor);
  48. return new SynchronousFuture(true);
  49. }
  50. bool _messagesExistFor(String locale) {
  51. try {
  52. return _findExact(locale) != null;
  53. } catch (e) {
  54. return false;
  55. }
  56. }
  57. MessageLookupByLibrary? _findGeneratedMessagesFor(String locale) {
  58. var actualLocale =
  59. Intl.verifiedLocale(locale, _messagesExistFor, onFailure: (_) => null);
  60. if (actualLocale == null) return null;
  61. return _findExact(actualLocale);
  62. }