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

Side by Side Diff: pkg/intl/lib/src/intl_helpers.dart

Issue 182443003: Add 'meaning' to Intl.messages (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 10 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 | « pkg/intl/lib/message_lookup_by_library.dart ('k') | pkg/intl/lib/src/intl_message.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 * A library for general helper code associated with the intl library 6 * A library for general helper code associated with the intl library
7 * rather than confined to specific parts of it. 7 * rather than confined to specific parts of it.
8 */ 8 */
9 9
10 library intl_helpers; 10 library intl_helpers;
11 11
12 import 'dart:async'; 12 import 'dart:async';
13 13
14 /** 14 /**
15 * This is used as a marker for a locale data map that hasn't been initialized, 15 * This is used as a marker for a locale data map that hasn't been initialized,
16 * and will throw an exception on any usage that isn't the fallback 16 * and will throw an exception on any usage that isn't the fallback
17 * patterns/symbols provided. 17 * patterns/symbols provided.
18 */ 18 */
19 class UninitializedLocaleData<F> { 19 class UninitializedLocaleData<F> {
20 final String message; 20 final String message;
21 final F fallbackData; 21 final F fallbackData;
22 const UninitializedLocaleData(this.message, this.fallbackData); 22 const UninitializedLocaleData(this.message, this.fallbackData);
23 23
24 operator [](String key) => 24 operator [](String key) =>
25 (key == 'en_US') ? fallbackData : _throwException(); 25 (key == 'en_US') ? fallbackData : _throwException();
26 26
27 String lookupMessage(String message_str, [final String desc='', 27 String lookupMessage(String message_str, [final String desc='',
28 final Map examples=const {}, String locale, 28 final Map examples=const {}, String locale,
29 String name, List<String> args]) => message_str; 29 String name, List<String> args, String meaning]) => message_str;
30 30
31 List get keys => _throwException(); 31 List get keys => _throwException();
32 32
33 bool containsKey(String key) => (key == 'en_US') ? true : _throwException(); 33 bool containsKey(String key) => (key == 'en_US') ? true : _throwException();
34 34
35 _throwException() { 35 _throwException() {
36 throw new LocaleDataException("Locale data has not been initialized" 36 throw new LocaleDataException("Locale data has not been initialized"
37 ", call $message."); 37 ", call $message.");
38 } 38 }
39 } 39 }
(...skipping 22 matching lines...) Expand all
62 /** 62 /**
63 * Initialize the message lookup mechanism. This is for internal use only. 63 * Initialize the message lookup mechanism. This is for internal use only.
64 * User applications should import `message_lookup_by_library.dart` and call 64 * User applications should import `message_lookup_by_library.dart` and call
65 * `initializeMessages` 65 * `initializeMessages`
66 */ 66 */
67 void initializeInternalMessageLookup(Function lookupFunction) { 67 void initializeInternalMessageLookup(Function lookupFunction) {
68 if (messageLookup is UninitializedLocaleData) { 68 if (messageLookup is UninitializedLocaleData) {
69 messageLookup = lookupFunction(); 69 messageLookup = lookupFunction();
70 } 70 }
71 } 71 }
OLDNEW
« no previous file with comments | « pkg/intl/lib/message_lookup_by_library.dart ('k') | pkg/intl/lib/src/intl_message.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698