| 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 * A utility program to take locale data represented as a Dart map whose keys | 6 * A utility program to take locale data represented as a Dart map whose keys |
| 7 * are locale names and write it into individual JSON files named by locale. | 7 * are locale names and write it into individual JSON files named by locale. |
| 8 * This should be run any time the locale data changes. | 8 * This should be run any time the locale data changes. |
| 9 * | 9 * |
| 10 * The files are written under "data/dates", in two subdirectories, "symbols" | 10 * The files are written under "data/dates", in two subdirectories, "symbols" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 outputStream.writeString( | 33 outputStream.writeString( |
| 34 '// Copyright (c) 2012, the Dart project authors. Please see the ' | 34 '// Copyright (c) 2012, the Dart project authors. Please see the ' |
| 35 'AUTHORS file\n// for details. All rights reserved. Use of this source' | 35 'AUTHORS file\n// for details. All rights reserved. Use of this source' |
| 36 'code is governed by a\n// BSD-style license that can be found in the' | 36 'code is governed by a\n// BSD-style license that can be found in the' |
| 37 ' LICENSE file.\n\n' | 37 ' LICENSE file.\n\n' |
| 38 '/// Hard-coded list of all available locales for dates.\n'); | 38 '/// Hard-coded list of all available locales for dates.\n'); |
| 39 outputStream.writeString('final availableLocalesForDateFormatting = const ['); | 39 outputStream.writeString('final availableLocalesForDateFormatting = const ['); |
| 40 List<String> allLocales = DateFormat.allLocalesWithSymbols(); | 40 List<String> allLocales = DateFormat.allLocalesWithSymbols(); |
| 41 allLocales.forEach((locale) { | 41 allLocales.forEach((locale) { |
| 42 outputStream.writeString('"$locale"'); | 42 outputStream.writeString('"$locale"'); |
| 43 if (locale == allLocales.last()) { | 43 if (locale == allLocales.last) { |
| 44 outputStream.writeString('];'); | 44 outputStream.writeString('];'); |
| 45 } else { | 45 } else { |
| 46 outputStream.writeString(',\n '); | 46 outputStream.writeString(',\n '); |
| 47 } | 47 } |
| 48 }); | 48 }); |
| 49 } | 49 } |
| 50 | 50 |
| 51 void writeSymbolData() { | 51 void writeSymbolData() { |
| 52 dateTimeSymbolMap().forEach( | 52 dateTimeSymbolMap().forEach( |
| 53 (locale, symbols) => writeSymbols(locale, symbols)); | 53 (locale, symbols) => writeSymbols(locale, symbols)); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 68 void writePatterns(locale, patterns) { | 68 void writePatterns(locale, patterns) { |
| 69 var file = new File('${dataDirectory}patterns/${locale}.json'); | 69 var file = new File('${dataDirectory}patterns/${locale}.json'); |
| 70 var outputStream = file.openOutputStream(); | 70 var outputStream = file.openOutputStream(); |
| 71 outputStream.writeString(JSON.stringify(patterns)); | 71 outputStream.writeString(JSON.stringify(patterns)); |
| 72 outputStream.close(); | 72 outputStream.close(); |
| 73 } | 73 } |
| 74 | 74 |
| 75 void writeToJSON(Dynamic data, OutputStream out) { | 75 void writeToJSON(Dynamic data, OutputStream out) { |
| 76 out.writeString(JSON.stringify(data.serializeToMap())); | 76 out.writeString(JSON.stringify(data.serializeToMap())); |
| 77 } | 77 } |
| OLD | NEW |