Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2287)

Unified Diff: pkg/intl/tool/generate_locale_data_files.dart

Issue 12918018: Update Intl's json data file generation to current APIs (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Also remove polyfill reversing method Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« pkg/intl/lib/date_format.dart ('K') | « pkg/intl/lib/date_format.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/intl/tool/generate_locale_data_files.dart
diff --git a/pkg/intl/tool/generate_locale_data_files.dart b/pkg/intl/tool/generate_locale_data_files.dart
index a6fe140c8b86b60b7f3844a7cc0bbd4f9c4b8276..76ff2bd4da19aa74d54ad210ffb1593785726ba2 100644
--- a/pkg/intl/tool/generate_locale_data_files.dart
+++ b/pkg/intl/tool/generate_locale_data_files.dart
@@ -19,6 +19,7 @@ import '../lib/intl.dart';
import 'dart:io';
import 'dart:json' as json;
import '../test/data_directory.dart';
+import 'package:pathos/path.dart' as path;
main() {
initializeDateFormatting("en_IGNORED", null);
@@ -28,22 +29,23 @@ main() {
}
void writeLocaleList() {
- var file = new File('${dataDirectory}localeList.dart');
+ var file = new File(path.join(dataDirectory, 'localeList.dart'));
var output = file.openWrite();
- output.addString(
+ output.write(
'// Copyright (c) 2012, the Dart project authors. Please see the '
'AUTHORS file\n// for details. All rights reserved. Use of this source'
'code is governed by a\n// BSD-style license that can be found in the'
' LICENSE file.\n\n'
+ 'part of date_symbol_data_json;\n\n'
'/// Hard-coded list of all available locales for dates.\n');
- output.addString('final availableLocalesForDateFormatting = const [');
+ output.write('final availableLocalesForDateFormatting = const [');
List<String> allLocales = DateFormat.allLocalesWithSymbols();
allLocales.forEach((locale) {
- output.addString('"$locale"');
+ output.write('"$locale"');
if (locale == allLocales.last) {
- output.addString('];');
+ output.write('];');
} else {
- output.addString(',\n ');
+ output.write(',\n ');
}
});
output.close();
@@ -60,19 +62,19 @@ void writePatternData() {
}
void writeSymbols(locale, symbols) {
- var file = new File('${dataDirectory}symbols/${locale}.json');
+ var file = new File(path.join(dataDirectory, 'symbols', '${locale}.json'));
var output = file.openWrite();
writeToJSON(symbols, output);
output.close();
}
void writePatterns(locale, patterns) {
- var file = new File('${dataDirectory}patterns/${locale}.json');
+ var file = new File(path.join(dataDirectory, 'patterns', '${locale}.json'));
var output = file.openWrite();
- output.addString(json.stringify(patterns));
+ output.write(json.stringify(patterns));
output.close();
}
void writeToJSON(dynamic data, IOSink out) {
- out.addString(json.stringify(data.serializeToMap()));
+ out.write(json.stringify(data.serializeToMap()));
}
« pkg/intl/lib/date_format.dart ('K') | « pkg/intl/lib/date_format.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698