messages_all.dart 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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.dart' as messages_zh;
  17. typedef Future<dynamic> LibraryLoader();
  18. Map<String, LibraryLoader> _deferredLibraries = {
  19. 'en': () => new SynchronousFuture(null),
  20. 'zh': () => new SynchronousFuture(null),
  21. };
  22. MessageLookupByLibrary? _findExact(String localeName) {
  23. switch (localeName) {
  24. case 'en':
  25. return messages_en.messages;
  26. case 'zh':
  27. return messages_zh.messages;
  28. default:
  29. return null;
  30. }
  31. }
  32. /// User programs should call this before using [localeName] for messages.
  33. Future<bool> initializeMessages(String localeName) {
  34. var availableLocale = Intl.verifiedLocale(
  35. localeName, (locale) => _deferredLibraries[locale] != null,
  36. onFailure: (_) => null);
  37. if (availableLocale == null) {
  38. return new SynchronousFuture(false);
  39. }
  40. var lib = _deferredLibraries[availableLocale];
  41. lib == null ? new SynchronousFuture(false) : lib();
  42. initializeInternalMessageLookup(() => new CompositeMessageLookup());
  43. messageLookup.addLocale(availableLocale, _findGeneratedMessagesFor);
  44. return new SynchronousFuture(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 =
  55. Intl.verifiedLocale(locale, _messagesExistFor, onFailure: (_) => null);
  56. if (actualLocale == null) return null;
  57. return _findExact(actualLocale);
  58. }