Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1341)

Unified Diff: packages/intl/example/basic/messages_all.dart

Issue 1400473008: Roll Observatory packages and add a roll script (Closed) Base URL: git@github.com:dart-lang/observatory_pub_packages.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « packages/intl/example/basic/basic_example_runner.dart ('k') | packages/intl/example/basic/messages_de.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: packages/intl/example/basic/messages_all.dart
diff --git a/packages/intl/example/basic/messages_all.dart b/packages/intl/example/basic/messages_all.dart
new file mode 100644
index 0000000000000000000000000000000000000000..88942b305fdb7f6b843e26b51c765aa8d2881068
--- /dev/null
+++ b/packages/intl/example/basic/messages_all.dart
@@ -0,0 +1,42 @@
+// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+/**
+ * This imports all of the different message libraries and provides an
+ * [initializeMessages] function that sets up the lookup for a particular
+ * library.
+ */
+library messages_all;
+
+import 'dart:async';
+import 'package:intl/message_lookup_by_library.dart';
+import 'package:intl/src/intl_helpers.dart';
+import 'messages_th_th.dart' as th_TH;
+import 'messages_de.dart' as de;
+import 'package:intl/intl.dart';
+
+// TODO(alanknight): Use lazy loading of the requested library.
+MessageLookupByLibrary _findExact(localeName) {
+ switch (localeName) {
+ case 'th_TH':
+ return th_TH.messages;
+ case 'de':
+ return de.messages;
+ default:
+ return null;
+ }
+}
+
+initializeMessages(localeName) {
+ initializeInternalMessageLookup(() => new CompositeMessageLookup());
+ messageLookup.addLocale(localeName, _findGeneratedMessagesFor);
+ return new Future.value();
+}
+
+MessageLookupByLibrary _findGeneratedMessagesFor(locale) {
+ var actualLocale = Intl.verifiedLocale(locale, (x) => _findExact(x) != null,
+ onFailure: (_) => null);
+ if (actualLocale == null) return null;
+ return _findExact(actualLocale);
+}
« no previous file with comments | « packages/intl/example/basic/basic_example_runner.dart ('k') | packages/intl/example/basic/messages_de.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698