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

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

Issue 11267018: Make getKeys, getValues getters (keys, values). (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Update status files with co19 issue number. Created 8 years, 1 month 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/src/intl_helpers.dart ('k') | pkg/intl/test/date_time_format_test_core.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 defines a class for loading locale data incrementally from 6 * This defines a class for loading locale data incrementally from
7 * an external source as JSON. The external sources expected are either 7 * an external source as JSON. The external sources expected are either
8 * local files or via HTTP request. 8 * local files or via HTTP request.
9 */ 9 */
10 10
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 availableLocaleSet = new Set.from(availableLocales); 57 availableLocaleSet = new Set.from(availableLocales);
58 } 58 }
59 59
60 /** 60 /**
61 * Tests if we have data for the locale available. Note that this returns 61 * Tests if we have data for the locale available. Note that this returns
62 * true even if the data is known to be available remotely but not yet loaded. 62 * true even if the data is known to be available remotely but not yet loaded.
63 */ 63 */
64 bool containsKey(String locale) => availableLocaleSet.contains(locale); 64 bool containsKey(String locale) => availableLocaleSet.contains(locale);
65 65
66 /** Returns the list of keys/locale names. */ 66 /** Returns the list of keys/locale names. */
67 List getKeys() => availableLocales; 67 List get keys => availableLocales;
68 68
69 /** 69 /**
70 * Returns the data stored for [localeName]. If no data has been loaded 70 * Returns the data stored for [localeName]. If no data has been loaded
71 * for [localeName], throws an exception. If no data is available for 71 * for [localeName], throws an exception. If no data is available for
72 * [localeName] then throw an exception with a different message. 72 * [localeName] then throw an exception with a different message.
73 */ 73 */
74 operator [](String localeName) { 74 operator [](String localeName) {
75 if (containsKey(localeName)) { 75 if (containsKey(localeName)) {
76 var data = map[localeName]; 76 var data = map[localeName];
77 if (data == null) { 77 if (data == null) {
(...skipping 26 matching lines...) Expand all
104 } 104 }
105 105
106 /** 106 /**
107 * Given a Future [input] whose value is expected to be a string in JSON form, 107 * Given a Future [input] whose value is expected to be a string in JSON form,
108 * return another future that parses the JSON into a usable format. 108 * return another future that parses the JSON into a usable format.
109 */ 109 */
110 Future jsonData(Future input) { 110 Future jsonData(Future input) {
111 return input.transform( (response) => JSON.parse(response)); 111 return input.transform( (response) => JSON.parse(response));
112 } 112 }
113 } 113 }
OLDNEW
« no previous file with comments | « pkg/intl/lib/src/intl_helpers.dart ('k') | pkg/intl/test/date_time_format_test_core.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698