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

Unified Diff: packages/intl/lib/src/lazy_locale_data.dart

Issue 2989763002: Update charted to 0.4.8 and roll (Closed)
Patch Set: Removed Cutch from list of reviewers Created 3 years, 5 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/lib/src/intl_message.dart ('k') | packages/intl/lib/src/plural_rules.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: packages/intl/lib/src/lazy_locale_data.dart
diff --git a/packages/intl/lib/src/lazy_locale_data.dart b/packages/intl/lib/src/lazy_locale_data.dart
index 9be1c0d9a3c331d6bff6312cbdfe2ca078bca642..07d46f7bce4540bbedf611cc40eb8da2ba3f090c 100644
--- a/packages/intl/lib/src/lazy_locale_data.dart
+++ b/packages/intl/lib/src/lazy_locale_data.dart
@@ -2,11 +2,9 @@
// 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 defines a class for loading locale data incrementally from
- * an external source as JSON. The external sources expected are either
- * local files or via HTTP request.
- */
+/// This defines a class for loading locale data incrementally from
+/// an external source as JSON. The external sources expected are either
+/// local files or via HTTP request.
library lazy_locale_data;
@@ -14,11 +12,9 @@ import 'dart:async';
import 'dart:convert';
import 'intl_helpers.dart';
-/**
- * This implements the very basic map-type operations which are used
- * in locale lookup, and looks them up based on a URL that defines
- * the external source.
- */
+/// This implements the very basic map-type operations which are used
+/// in locale lookup, and looks them up based on a URL that defines
+/// the external source.
class LazyLocaleData {
/// This holds the data we have loaded.
Map map;
@@ -26,52 +22,41 @@ class LazyLocaleData {
/// The object that actually does the data reading.
LocaleDataReader _reader;
- /**
- * In order to avoid a potentially remote call to see if a locale
- * is available, we hold a complete list of all the available
- * locales.
- */
+ /// In order to avoid a potentially remote call to see if a locale
+ /// is available, we hold a complete list of all the available
+ /// locales.
List availableLocales;
- /**
- * Given a piece of remote data, apply [_creationFunction] to it to
- * convert it into the right form. Typically this means converting it
- * from a Map into an object form.
- */
+ /// Given a piece of remote data, apply [_creationFunction] to it to
+ /// convert it into the right form. Typically this means converting it
+ /// from a Map into an object form.
Function _creationFunction;
- /**
- * The set of available locales.
- */
+ /// The set of available locales.
Set availableLocaleSet;
- /**
- * The constructor. The [_reader] specifies where the data comes
- * from. The [_creationFunction] creates the appropriate data type
- * from the remote data (which typically comes in as a Map). The
- * [keys] lists the set of remotely available locale names so we know which
- * things can be fetched without having to check remotely.
- */
+ /// The constructor. The [_reader] specifies where the data comes
+ /// from. The [_creationFunction] creates the appropriate data type
+ /// from the remote data (which typically comes in as a Map). The
+ /// [keys] lists the set of remotely available locale names so we know which
+ /// things can be fetched without having to check remotely.
LazyLocaleData(this._reader, this._creationFunction, List keys) {
map = new Map();
availableLocales = keys;
availableLocaleSet = new Set.from(availableLocales);
}
- /**
- * Tests if we have data for the locale available. Note that this returns
- * true even if the data is known to be available remotely but not yet loaded.
- */
+ /// Tests if we have data for the locale available. Note that this returns
+ /// true even if the data is known to be available remotely but not yet
+ /// loaded.
bool containsKey(String locale) => availableLocaleSet.contains(locale);
- /** Returns the list of keys/locale names. */
+ /// Returns the list of keys/locale names.
List get keys => availableLocales;
- /**
- * Returns the data stored for [localeName]. If no data has been loaded
- * for [localeName], throws an exception. If no data is available for
- * [localeName] then throw an exception with a different message.
- */
+ /// Returns the data stored for [localeName]. If no data has been loaded
+ /// for [localeName], throws an exception. If no data is available for
+ /// [localeName] then throw an exception with a different message.
operator [](String localeName) {
if (containsKey(localeName)) {
var data = map[localeName];
@@ -87,18 +72,14 @@ class LazyLocaleData {
}
}
- /**
- * Throw an exception indicating that the locale has no data available,
- * either locally or remotely.
- */
+ /// Throw an exception indicating that the locale has no data available,
+ /// either locally or remotely.
unsupportedLocale(localeName) {
throw new LocaleDataException('Locale $localeName has no data available');
}
- /**
- * Initialize for locale. Internal use only. As a user, call
- * initializeDateFormatting instead.
- */
+ /// Initialize for locale. Internal use only. As a user, call
+ /// initializeDateFormatting instead.
Future initLocale(String localeName) {
var data = _reader.read(localeName);
return jsonData(data).then((input) {
@@ -106,10 +87,8 @@ class LazyLocaleData {
});
}
- /**
- * Given a Future [input] whose value is expected to be a string in JSON form,
- * return another future that parses the JSON into a usable format.
- */
+ /// Given a Future [input] whose value is expected to be a string in JSON
+ /// form, return another future that parses the JSON into a usable format.
Future jsonData(Future input) {
return input.then((response) => JSON.decode(response));
}
« no previous file with comments | « packages/intl/lib/src/intl_message.dart ('k') | packages/intl/lib/src/plural_rules.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698