| 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" |
| 11 * and "patterns". In "data/dates" it will also generate "localeList.dart", | 11 * and "patterns". In "data/dates" it will also generate "localeList.dart", |
| 12 * which is sourced by the date_symbol_data... files. | 12 * which is sourced by the date_symbol_data... files. |
| 13 */ | 13 */ |
| 14 | 14 |
| 15 import '../lib/date_symbols.dart'; | 15 import '../lib/date_symbols.dart'; |
| 16 import '../lib/date_symbol_data_local.dart'; | 16 import '../lib/date_symbol_data_local.dart'; |
| 17 import '../lib/date_time_patterns.dart'; | 17 import '../lib/date_time_patterns.dart'; |
| 18 import '../lib/intl.dart'; | 18 import '../lib/intl.dart'; |
| 19 import 'dart:io'; | 19 import 'dart:io'; |
| 20 import 'dart:json' as json; | 20 import 'dart:json' as json; |
| 21 import '../test/data_directory.dart'; | 21 import '../test/data_directory.dart'; |
| 22 import 'package:pathos/path.dart' as path; | 22 import 'package:path/path.dart' as path; |
| 23 | 23 |
| 24 main() { | 24 main() { |
| 25 initializeDateFormatting("en_IGNORED", null); | 25 initializeDateFormatting("en_IGNORED", null); |
| 26 writeSymbolData(); | 26 writeSymbolData(); |
| 27 writePatternData(); | 27 writePatternData(); |
| 28 writeLocaleList(); | 28 writeLocaleList(); |
| 29 } | 29 } |
| 30 | 30 |
| 31 void writeLocaleList() { | 31 void writeLocaleList() { |
| 32 var file = new File(path.join(dataDirectory, 'localeList.dart')); | 32 var file = new File(path.join(dataDirectory, 'localeList.dart')); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 void writePatterns(locale, patterns) { | 71 void writePatterns(locale, patterns) { |
| 72 var file = new File(path.join(dataDirectory, 'patterns', '${locale}.json')); | 72 var file = new File(path.join(dataDirectory, 'patterns', '${locale}.json')); |
| 73 var output = file.openWrite(); | 73 var output = file.openWrite(); |
| 74 output.write(json.stringify(patterns)); | 74 output.write(json.stringify(patterns)); |
| 75 output.close(); | 75 output.close(); |
| 76 } | 76 } |
| 77 | 77 |
| 78 void writeToJSON(dynamic data, IOSink out) { | 78 void writeToJSON(dynamic data, IOSink out) { |
| 79 out.write(json.stringify(data.serializeToMap())); | 79 out.write(json.stringify(data.serializeToMap())); |
| 80 } | 80 } |
| OLD | NEW |