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

Side by Side Diff: pkg/intl/example/basic/messages_all.dart

Issue 179783004: Verify the default locale in case we're given an invalid one and need to fall back. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Review fixes Created 6 years, 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | pkg/intl/lib/generate_localized.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 /** 5 /**
6 * This imports all of the different message libraries and provides an 6 * This imports all of the different message libraries and provides an
7 * [initializeMessages] function that sets up the lookup for a particular 7 * [initializeMessages] function that sets up the lookup for a particular
8 * library. 8 * library.
9 */ 9 */
10 library messages_all; 10 library messages_all;
(...skipping 14 matching lines...) Expand all
25 } 25 }
26 } 26 }
27 27
28 initializeMessages(localeName) { 28 initializeMessages(localeName) {
29 initializeInternalMessageLookup(() => new CompositeMessageLookup()); 29 initializeInternalMessageLookup(() => new CompositeMessageLookup());
30 messageLookup.addLocale(localeName, _findGeneratedMessagesFor); 30 messageLookup.addLocale(localeName, _findGeneratedMessagesFor);
31 return new Future.value(); 31 return new Future.value();
32 } 32 }
33 33
34 MessageLookupByLibrary _findGeneratedMessagesFor(locale) { 34 MessageLookupByLibrary _findGeneratedMessagesFor(locale) {
35 var actualLocale = Intl.verifiedLocale(locale, (x) => _findExact(x) != null); 35 var actualLocale = Intl.verifiedLocale(locale, (x) => _findExact(x) != null,
36 onFailure: (_) => null);
36 if (actualLocale == null) return null; 37 if (actualLocale == null) return null;
37 return _findExact(actualLocale); 38 return _findExact(actualLocale);
38 } 39 }
OLDNEW
« no previous file with comments | « no previous file | pkg/intl/lib/generate_localized.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698