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

Side by Side Diff: samples/polymer_intl/web/messages_all.dart

Issue 105073003: Adds a sample for polymer internationalization/localization (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Changes from review Created 7 years 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 | « samples/polymer_intl/web/localized.html ('k') | samples/polymer_intl/web/messages_fr.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) 2013, the Dart project authors. Please see the AUTHORS file
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.
4
1 /** 5 /**
2 * DO NOT EDIT. This is code generated via pkg/intl/generate_localized.dart 6 * DO NOT EDIT. This is code generated via pkg/intl/generate_localized.dart
3 * This is a library that looks up messages for specific locales by 7 * This is a library that looks up messages for specific locales by
4 * delegating to the appropriate library. 8 * delegating to the appropriate library.
5 */ 9 */
6 10
7 library messages_all; 11 library messages_all;
8 12
9 import 'dart:async'; 13 import 'dart:async';
10 import 'package:intl/message_lookup_by_library.dart'; 14 import 'package:intl/message_lookup_by_library.dart';
11 import 'package:intl/src/intl_helpers.dart'; 15 import 'package:intl/src/intl_helpers.dart';
12 import 'package:intl/intl.dart'; 16 import 'package:intl/intl.dart';
13 17
14 import 'foo_messages_fr.dart' as messages_fr; 18 import 'messages_fr.dart' as messages_fr;
15 import 'foo_messages_de_DE.dart' as messages_de_DE; 19 import 'messages_pt.dart' as messages_pt;
16 20
17 21
18 MessageLookupByLibrary _findExact(localeName) { 22 MessageLookupByLibrary _findExact(localeName) {
19 switch (localeName) { 23 switch (localeName) {
20 case 'fr' : return messages_fr.messages; 24 case 'fr' : return messages_fr.messages;
21 case 'de_DE' : return messages_de_DE.messages; 25 case 'pt' : return messages_pt.messages;
22 default: return null; 26 default: return null;
23 } 27 }
24 } 28 }
25 29
26 /** User programs should call this before using [localeName] for messages.*/ 30 /** User programs should call this before using [localeName] for messages.*/
27 Future initializeMessages(String localeName) { 31 Future initializeMessages(String localeName) {
28 initializeInternalMessageLookup(() => new CompositeMessageLookup()); 32 initializeInternalMessageLookup(() => new CompositeMessageLookup());
29 messageLookup.addLocale(localeName, _findGeneratedMessagesFor); 33 messageLookup.addLocale(localeName, _findGeneratedMessagesFor);
30 // TODO(alanknight): Restore once Issue 12824 is fixed. 34 // TODO(alanknight): Restore once Issue 12824 is fixed.
31 // var lib = deferredLibraries[localeName]; 35 // var lib = deferredLibraries[localeName];
32 // return lib == null ? new Future.value(false) : lib.load(); 36 // return lib == null ? new Future.value(false) : lib.load();
33 return new Future.value(true); 37 return new Future.value(true);
34 } 38 }
35 39
36 MessageLookupByLibrary _findGeneratedMessagesFor(locale) { 40 MessageLookupByLibrary _findGeneratedMessagesFor(locale) {
37 var actualLocale = Intl.verifiedLocale(locale, (x) => _findExact(x) != null); 41 var actualLocale = Intl.verifiedLocale(locale, (x) => _findExact(x) != null);
38 if (actualLocale == null) return null; 42 if (actualLocale == null) return null;
39 return _findExact(actualLocale); 43 return _findExact(actualLocale);
40 } 44 }
OLDNEW
« no previous file with comments | « samples/polymer_intl/web/localized.html ('k') | samples/polymer_intl/web/messages_fr.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698