Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // BSD-style license that can be found in the LICENSE file. | |
| 4 | |
| 5 /** | |
| 6 * This file should be imported, along with date_format.dart in order to read | |
| 7 * locale data from files in the file system. | |
| 8 */ | |
| 9 | |
| 10 #library('date_symbol_data_json'); | |
| 11 | |
| 12 #import("date_symbols.dart"); | |
| 13 #import("lib/lazy_locale_data.dart"); | |
| 14 #import('lib/date_format_internal.dart'); | |
| 15 #import('lib/file_data_reader.dart'); | |
| 16 | |
| 17 #source("data/dates/localeList.dart"); | |
| 18 | |
| 19 /** | |
| 20 * 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 [path]. | |
| 22 * The [path] parameter should end with a /. | |
| 23 * For some implementations this may be a no-op. | |
|
Emily Fortuna
2012/09/04 20:14:42
Explain briefly when/why would this be a no-op.
Alan Knight
2012/09/04 23:39:03
Actually, it's not true, because even for the loca
| |
| 24 */ | |
| 25 Future initializeDateFormatting(String locale, String path) { | |
| 26 var reader = new FileDataReader('${path}symbols/'); | |
|
Emily Fortuna
2012/09/04 20:14:42
You can use the Path separator from the Platform c
Alan Knight
2012/09/04 23:39:03
Done.
| |
| 27 initializeDateSymbols(() => new LazyLocaleData( | |
| 28 reader, _createDateSymbol, availableLocalesForDateFormatting)); | |
| 29 var reader2 = new FileDataReader('${path}patterns/'); | |
| 30 initializeDatePatterns(() => new LazyLocaleData( | |
| 31 reader2, (x) => x, availableLocalesForDateFormatting)); | |
| 32 return initializeIndividualLocaleDateFormatting( | |
| 33 (symbols, patterns) { | |
| 34 return Futures.wait([ | |
| 35 symbols.initLocale(locale), | |
| 36 patterns.initLocale(locale)]); | |
| 37 }); | |
| 38 } | |
| 39 | |
| 40 /** Defines how new date symbol entries are created. */ | |
| 41 DateSymbols _createDateSymbol(Map map) { | |
| 42 return new DateSymbols.deserializeFromMap(map); | |
| 43 } | |
| OLD | NEW |