| 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 #library("date_symbols"); | 4 #library("date_symbols"); |
| 5 | 5 |
| 6 /** | 6 /** |
| 7 * This holds onto information about how a particular locale formats dates. It | 7 * This holds onto information about how a particular locale formats dates. It |
| 8 * contains mostly strings, e.g. what the names of months or weekdays are, | 8 * contains mostly strings, e.g. what the names of months or weekdays are, |
| 9 * but also indicates things like the first day of the week. We expect the data | 9 * but also indicates things like the first day of the week. We expect the data |
| 10 * for instances of these to be generated out of ICU or a similar reference | 10 * for instances of these to be generated out of ICU or a similar reference |
| 11 * source. This is used in conjunction with the date_time_patterns, which | 11 * source. This is used in conjunction with the date_time_patterns, which |
| 12 * defines for a particular locale the different named formats that will | 12 * defines for a particular locale the different named formats that will |
| 13 * make use of this data. | 13 * make use of this data. |
| 14 */ | 14 */ |
| 15 class DateSymbols { | 15 class DateSymbols { |
| 16 String NAME; | 16 String NAME; |
| 17 List<String> ERAS, ERANAMES, NARROWMONTHS, STANDALONENARROWMONTHS, | 17 List<String> ERAS, ERANAMES, NARROWMONTHS, STANDALONENARROWMONTHS, |
| 18 MONTHS, STANDALONEMONTHS, SHORTMONTHS, STANDALONESHORTMONTHS, WEEKDAYS, | 18 MONTHS, STANDALONEMONTHS, SHORTMONTHS, STANDALONESHORTMONTHS, WEEKDAYS, |
| 19 STANDALONEWEEKDAYS, SHORTWEEKDAYS, STANDALONESHORTWEEKDAYS, | 19 STANDALONEWEEKDAYS, SHORTWEEKDAYS, STANDALONESHORTWEEKDAYS, |
| 20 NARROWWEEKDAYS, STANDALONENARROWWEEKDAYS, SHORTQUARTERS, | 20 NARROWWEEKDAYS, STANDALONENARROWWEEKDAYS, SHORTQUARTERS, |
| 21 QUARTERS, AMPMS, DATEFORMATS, TIMEFORMATS; | 21 QUARTERS, AMPMS, DATEFORMATS, TIMEFORMATS; |
| 22 Map<String, String> AVAILABLEFORMATS; | 22 Map<String, String> AVAILABLEFORMATS; |
| 23 int FIRSTDAYOFWEEK; | 23 int FIRSTDAYOFWEEK; |
| 24 List<int> WEEKENDRANGE; | 24 List<int> WEEKENDRANGE; |
| 25 int FIRSTWEEKCUTOFFDAY; | 25 int FIRSTWEEKCUTOFFDAY; |
| 26 | 26 |
| 27 DateSymbols([this.NAME, | 27 DateSymbols({this.NAME, |
| 28 this.ERAS, | 28 this.ERAS, |
| 29 this.ERANAMES, | 29 this.ERANAMES, |
| 30 this.NARROWMONTHS, | 30 this.NARROWMONTHS, |
| 31 this.STANDALONENARROWMONTHS, | 31 this.STANDALONENARROWMONTHS, |
| 32 this.MONTHS, | 32 this.MONTHS, |
| 33 this.STANDALONEMONTHS, | 33 this.STANDALONEMONTHS, |
| 34 this.SHORTMONTHS, | 34 this.SHORTMONTHS, |
| 35 this.STANDALONESHORTMONTHS, | 35 this.STANDALONESHORTMONTHS, |
| 36 this.WEEKDAYS, | 36 this.WEEKDAYS, |
| 37 this.STANDALONEWEEKDAYS, | 37 this.STANDALONEWEEKDAYS, |
| 38 this.SHORTWEEKDAYS, | 38 this.SHORTWEEKDAYS, |
| 39 this.STANDALONESHORTWEEKDAYS, | 39 this.STANDALONESHORTWEEKDAYS, |
| 40 this.NARROWWEEKDAYS, | 40 this.NARROWWEEKDAYS, |
| 41 this.STANDALONENARROWWEEKDAYS, | 41 this.STANDALONENARROWWEEKDAYS, |
| 42 this.SHORTQUARTERS, | 42 this.SHORTQUARTERS, |
| 43 this.QUARTERS, | 43 this.QUARTERS, |
| 44 this.AMPMS, | 44 this.AMPMS, |
| 45 // TODO(alanknight): These formats are taken from Closure, | 45 // TODO(alanknight): These formats are taken from Closure, |
| 46 // where there's only a fixed set of available formats. | 46 // where there's only a fixed set of available formats. |
| 47 // Here we have the patterns separately. These should | 47 // Here we have the patterns separately. These should |
| 48 // either be used, or removed. | 48 // either be used, or removed. |
| 49 this.DATEFORMATS, | 49 this.DATEFORMATS, |
| 50 this.TIMEFORMATS, | 50 this.TIMEFORMATS, |
| 51 this.AVAILABLEFORMATS, | 51 this.AVAILABLEFORMATS, |
| 52 this.FIRSTDAYOFWEEK, | 52 this.FIRSTDAYOFWEEK, |
| 53 this.WEEKENDRANGE, | 53 this.WEEKENDRANGE, |
| 54 this.FIRSTWEEKCUTOFFDAY]); | 54 this.FIRSTWEEKCUTOFFDAY}); |
| 55 | 55 |
| 56 // TODO(alanknight): Replace this with use of a more general serialization | 56 // TODO(alanknight): Replace this with use of a more general serialization |
| 57 // facility once one is available. Issue 4926. | 57 // facility once one is available. Issue 4926. |
| 58 DateSymbols.deserializeFromMap(Map map) { | 58 DateSymbols.deserializeFromMap(Map map) { |
| 59 NAME = map["NAME"]; | 59 NAME = map["NAME"]; |
| 60 ERAS = map["ERAS"]; | 60 ERAS = map["ERAS"]; |
| 61 ERANAMES = map["ERANAMES"]; | 61 ERANAMES = map["ERANAMES"]; |
| 62 NARROWMONTHS = map["NARROWMONTHS"]; | 62 NARROWMONTHS = map["NARROWMONTHS"]; |
| 63 STANDALONENARROWMONTHS = map["STANDALONENARROWMONTHS"]; | 63 STANDALONENARROWMONTHS = map["STANDALONENARROWMONTHS"]; |
| 64 MONTHS = map["MONTHS"]; | 64 MONTHS = map["MONTHS"]; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 map["TIMEFORMATS"] = TIMEFORMATS; | 106 map["TIMEFORMATS"] = TIMEFORMATS; |
| 107 map["AVAILABLEFORMATS"] = AVAILABLEFORMATS; | 107 map["AVAILABLEFORMATS"] = AVAILABLEFORMATS; |
| 108 map["FIRSTDAYOFWEEK"] = FIRSTDAYOFWEEK; | 108 map["FIRSTDAYOFWEEK"] = FIRSTDAYOFWEEK; |
| 109 map["WEEKENDRANGE"] = WEEKENDRANGE; | 109 map["WEEKENDRANGE"] = WEEKENDRANGE; |
| 110 map["FIRSTWEEKCUTOFFDAY"] = FIRSTWEEKCUTOFFDAY; | 110 map["FIRSTWEEKCUTOFFDAY"] = FIRSTWEEKCUTOFFDAY; |
| 111 return map; | 111 return map; |
| 112 } | 112 } |
| 113 | 113 |
| 114 toString() => NAME; | 114 toString() => NAME; |
| 115 } | 115 } |
| OLD | NEW |