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

Side by Side Diff: packages/intl/lib/date_symbol_data_http_request.dart

Issue 2989763002: Update charted to 0.4.8 and roll (Closed)
Patch Set: Removed Cutch from list of reviewers Created 3 years, 4 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
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 /// This file should be imported, along with date_format.dart in order to read
6 * This file should be imported, along with date_format.dart in order to read 6 /// locale data via http requests to a web server..
7 * locale data via http requests to a web server..
8 */
9 library date_symbol_data_http_request; 7 library date_symbol_data_http_request;
10 8
11 import 'dart:async'; 9 import 'dart:async';
12 10
13 import 'date_symbols.dart'; 11 import 'date_symbols.dart';
14 import 'intl.dart'; 12 import 'intl.dart';
15 import 'src/data/dates/locale_list.dart'; 13 import 'src/data/dates/locale_list.dart';
16 import 'src/date_format_internal.dart'; 14 import 'src/date_format_internal.dart';
17 import 'src/http_request_data_reader.dart'; 15 import 'src/http_request_data_reader.dart';
18 import 'src/lazy_locale_data.dart'; 16 import 'src/lazy_locale_data.dart';
19 17
20 export 'src/data/dates/locale_list.dart'; 18 export 'src/data/dates/locale_list.dart';
21 19
22 /** 20 /// This should be called for at least one [locale] before any date formatting
23 * This should be called for at least one [locale] before any date formatting 21 /// methods are called. It sets up the lookup for date symbols using [url].
24 * methods are called. It sets up the lookup for date symbols using [url]. 22 /// The [url] parameter should end with a "/". For example,
25 * The [url] parameter should end with a "/". For example, 23 /// "http://localhost:8000/dates/"
26 * "http://localhost:8000/dates/"
27 */
28 Future initializeDateFormatting(String locale, String url) { 24 Future initializeDateFormatting(String locale, String url) {
29 var reader = new HttpRequestDataReader('${url}symbols/'); 25 var reader = new HttpRequestDataReader('${url}symbols/');
30 initializeDateSymbols(() => new LazyLocaleData( 26 initializeDateSymbols(() => new LazyLocaleData(
31 reader, _createDateSymbol, availableLocalesForDateFormatting)); 27 reader, _createDateSymbol, availableLocalesForDateFormatting));
32 var reader2 = new HttpRequestDataReader('${url}patterns/'); 28 var reader2 = new HttpRequestDataReader('${url}patterns/');
33 initializeDatePatterns(() => 29 initializeDatePatterns(() =>
34 new LazyLocaleData(reader2, (x) => x, availableLocalesForDateFormatting)); 30 new LazyLocaleData(reader2, (x) => x, availableLocalesForDateFormatting));
35 var actualLocale = Intl.verifiedLocale( 31 var actualLocale = Intl.verifiedLocale(
36 locale, (l) => availableLocalesForDateFormatting.contains(l)); 32 locale, (l) => availableLocalesForDateFormatting.contains(l));
37 return initializeIndividualLocaleDateFormatting((symbols, patterns) { 33 return initializeIndividualLocaleDateFormatting((symbols, patterns) {
38 return Future.wait( 34 return Future.wait(<Future>[
39 [symbols.initLocale(actualLocale), patterns.initLocale(actualLocale)]); 35 symbols.initLocale(actualLocale),
36 patterns.initLocale(actualLocale)
37 ]);
40 }); 38 });
41 } 39 }
42 40
43 /** Defines how new date symbol entries are created. */ 41 /// Defines how new date symbol entries are created.
44 DateSymbols _createDateSymbol(Map map) => 42 DateSymbols _createDateSymbol(Map map) =>
45 new DateSymbols.deserializeFromMap(map); 43 new DateSymbols.deserializeFromMap(map);
OLDNEW
« no previous file with comments | « packages/intl/lib/date_symbol_data_file.dart ('k') | packages/intl/lib/date_symbol_data_local.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698