messages_all.dart 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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,
  40. (locale) => _deferredLibraries[locale] != null,
  41. onFailure: (_) => null,
  42. );
  43. if (availableLocale == null) {
  44. return new SynchronousFuture(false);
  45. }
  46. var lib = _deferredLibraries[availableLocale];
  47. lib == null ? new SynchronousFuture(false) : lib();
  48. initializeInternalMessageLookup(() => new CompositeMessageLookup());
  49. messageLookup.addLocale(availableLocale, _findGeneratedMessagesFor);
  50. return new SynchronousFuture(true);
  51. }
  52. bool _messagesExistFor(String locale) {
  53. try {
  54. return _findExact(locale) != null;
  55. } catch (e) {
  56. return false;
  57. }
  58. }
  59. MessageLookupByLibrary? _findGeneratedMessagesFor(String locale) {
  60. var actualLocale = Intl.verifiedLocale(
  61. locale,
  62. _messagesExistFor,
  63. onFailure: (_) => null,
  64. );
  65. if (actualLocale == null) return null;
  66. return _findExact(actualLocale);
  67. }