OLD | NEW |
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 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 |
7 * locale data via http requests to a web server.. | 7 * locale data via http requests to a web server.. |
8 */ | 8 */ |
9 library date_symbol_data_json; | 9 library date_symbol_data_json; |
10 | 10 |
(...skipping 13 matching lines...) Expand all Loading... |
24 */ | 24 */ |
25 Future initializeDateFormatting(String locale, String url) { | 25 Future initializeDateFormatting(String locale, String url) { |
26 var reader = new HTTPRequestDataReader('${url}symbols/'); | 26 var reader = new HTTPRequestDataReader('${url}symbols/'); |
27 initializeDateSymbols(() => new LazyLocaleData( | 27 initializeDateSymbols(() => new LazyLocaleData( |
28 reader, _createDateSymbol, availableLocalesForDateFormatting)); | 28 reader, _createDateSymbol, availableLocalesForDateFormatting)); |
29 var reader2 = new HTTPRequestDataReader('${url}patterns/'); | 29 var reader2 = new HTTPRequestDataReader('${url}patterns/'); |
30 initializeDatePatterns(() => new LazyLocaleData( | 30 initializeDatePatterns(() => new LazyLocaleData( |
31 reader2, (x) => x, availableLocalesForDateFormatting)); | 31 reader2, (x) => x, availableLocalesForDateFormatting)); |
32 return initializeIndividualLocaleDateFormatting( | 32 return initializeIndividualLocaleDateFormatting( |
33 (symbols, patterns) { | 33 (symbols, patterns) { |
34 return Futures.wait([ | 34 return Future.wait([ |
35 symbols.initLocale(locale), | 35 symbols.initLocale(locale), |
36 patterns.initLocale(locale)]); | 36 patterns.initLocale(locale)]); |
37 }); | 37 }); |
38 } | 38 } |
39 | 39 |
40 /** Defines how new date symbol entries are created. */ | 40 /** Defines how new date symbol entries are created. */ |
41 DateSymbols _createDateSymbol(Map map) { | 41 DateSymbols _createDateSymbol(Map map) { |
42 return new DateSymbols.deserializeFromMap(map); | 42 return new DateSymbols.deserializeFromMap(map); |
43 } | 43 } |
OLD | NEW |