messages_all.dart 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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. typedef Future<dynamic> LibraryLoader();
  16. Map<String, LibraryLoader> _deferredLibraries = {
  17. 'en': () => new Future.value(null),
  18. };
  19. MessageLookupByLibrary _findExact(String localeName) {
  20. switch (localeName) {
  21. case 'en':
  22. return messages_en.messages;
  23. default:
  24. return null;
  25. }
  26. }
  27. /// User programs should call this before using [localeName] for messages.
  28. Future<bool> initializeMessages(String localeName) async {
  29. var availableLocale = Intl.verifiedLocale(
  30. localeName,
  31. (locale) => _deferredLibraries[locale] != null,
  32. onFailure: (_) => null);
  33. if (availableLocale == null) {
  34. return new Future.value(false);
  35. }
  36. var lib = _deferredLibraries[availableLocale];
  37. await (lib == null ? new Future.value(false) : lib());
  38. initializeInternalMessageLookup(() => new CompositeMessageLookup());
  39. messageLookup.addLocale(availableLocale, _findGeneratedMessagesFor);
  40. return new Future.value(true);
  41. }
  42. bool _messagesExistFor(String locale) {
  43. try {
  44. return _findExact(locale) != null;
  45. } catch (e) {
  46. return false;
  47. }
  48. }
  49. MessageLookupByLibrary _findGeneratedMessagesFor(String locale) {
  50. var actualLocale = Intl.verifiedLocale(locale, _messagesExistFor,
  51. onFailure: (_) => null);
  52. if (actualLocale == null) return null;
  53. return _findExact(actualLocale);
  54. }