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

Unified Diff: pkg/intl/lib/generate_localized.dart

Issue 13898014: Allow suppressing message extraction warnings, providing a prefix for generated files, and format w… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: More fixes Created 7 years, 8 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
« no previous file with comments | « pkg/intl/lib/extract_messages.dart ('k') | pkg/intl/lib/number_format.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/intl/lib/generate_localized.dart
diff --git a/pkg/intl/lib/generate_localized.dart b/pkg/intl/lib/generate_localized.dart
index 26fb3041010493938ab28fd9643868f013d72f0f..c40d1f64705f6e985abef5ae5ed996ae67e1520f 100644
--- a/pkg/intl/lib/generate_localized.dart
+++ b/pkg/intl/lib/generate_localized.dart
@@ -47,6 +47,12 @@ String importForGeneratedFile(String file) =>
List<String> allLocales = [];
/**
+ * If we have more than one set of messages to generate in a particular
+ * directory we may want to prefix some to distinguish them.
+ */
+String generatedFilePrefix = '';
+
+/**
* This represents a message and its translation. We assume that the translation
* has some identifier that allows us to figure out the original message it
* corresponds to, and that it may want to transform the translated text in
@@ -101,13 +107,15 @@ void generateIndividualMessageFile(String locale,
result.write(entries.join(",\n"));
result.write("\n };\n}");
- var output = new File(path.join(targetDir, "messages_$locale.dart"));
+ var output = new File(path.join(targetDir,
+ "${generatedFilePrefix}messages_$locale.dart"));
output.writeAsStringSync(result.toString());
}
/**
- * This returns the mostly constant string used in [generated] for the
- * beginning of the file, parameterized by [locale].
+ * This returns the mostly constant string used in
+ * [generateIndividualMessageFile] for the beginning of the file,
+ * parameterized by [locale].
*/
String prologue(String locale) => """
/**
@@ -136,7 +144,7 @@ String generateMainImportFile() {
var output = new StringBuffer();
output.write(mainPrologue);
for (var each in allLocales) {
- var baseFile = 'messages_$each.dart';
+ var baseFile = '${generatedFilePrefix}messages_$each.dart';
var file = importForGeneratedFile(baseFile);
output.write("import '$file' as ${asLibraryName(each)};\n");
}
@@ -172,7 +180,7 @@ import 'package:$intlImportPath/intl.dart';
""";
/**
- * Constant string used in [generateMainImportfile] as the end of the file.
+ * Constant string used in [generateMainImportFile] as the end of the file.
*/
const closing = """
default: return null;
« no previous file with comments | « pkg/intl/lib/extract_messages.dart ('k') | pkg/intl/lib/number_format.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698