Index: pkg/intl/lib/generate_localized.dart |
diff --git a/pkg/intl/lib/generate_localized.dart b/pkg/intl/lib/generate_localized.dart |
index f6a42254eff6bf1cbc30f94259985e2e41c07686..610d0198aa62bf0aafbb2c06c50bb77c241a5978 100644 |
--- a/pkg/intl/lib/generate_localized.dart |
+++ b/pkg/intl/lib/generate_localized.dart |
@@ -61,14 +61,24 @@ String generatedFilePrefix = ''; |
* mechanisms are expected to subclass this. |
*/ |
abstract class TranslatedMessage { |
- /** The identifier for this message. In the simplest case, this is the name.*/ |
- var id; |
+ /** |
+ * The identifier for this message. In the simplest case, this is the name, |
Emily Fortuna
2013/07/03 17:52:33
sorry, name of what?
Alan Knight
2013/07/03 18:41:07
Clarified.
|
+ * but it can be any identifier that this program and the output of the |
+ * translation can agree on as identifying a message. |
+ */ |
+ String id; |
- String translatedString; |
- IntlMessage originalMessage; |
- TranslatedMessage(this.id, this.translatedString); |
+ /** Our translated version of [originalMessage]. */ |
+ Message translated; |
- String get message => translatedString; |
+ /** The original message that we are a translation of. */ |
+ MainMessage originalMessage; |
+ |
+ TranslatedMessage(this.id, this.translated); |
+ |
+ get message => translated; |
Emily Fortuna
2013/07/03 17:52:33
I think we prefer to still have return types, espe
Alan Knight
2013/07/03 18:41:07
There should be very few others using these APIs,
|
+ |
+ toString() => id.toString(); |
} |
/** |
@@ -78,13 +88,13 @@ abstract class TranslatedMessage { |
String asLibraryName(String x) => x.replaceAll('-', '_'); |
/** |
- * Generate a file messages_<locale>.dart for the [translations] in |
- * [locale]. |
+ * Generate a file <[generated_file_prefix]>_messages_<[locale]>.dart |
+ * for the [translations] in [locale] and put it in [targetDir]. |
*/ |
void generateIndividualMessageFile(String locale, |
Iterable<TranslatedMessage> translations, String targetDir) { |
var result = new StringBuffer(); |
- locale = new IntlMessage().escapeAndValidate(locale, locale); |
+ locale = new MainMessage().escapeAndValidateString(locale); |
result.write(prologue(locale)); |
// Exclude messages with no translation and translations with no matching |
// original message (e.g. if we're using some messages from a larger catalog) |
@@ -95,9 +105,9 @@ void generateIndividualMessageFile(String locale, |
} |
usableTranslations.sort((a, b) => |
a.originalMessage.name.compareTo(b.originalMessage.name)); |
- for (var each in usableTranslations) { |
+ for (var translation in usableTranslations) { |
result.write(" "); |
- result.write(each.originalMessage.toCode(locale)); |
+ result.write(translation.originalMessage.toCodeForLocale(locale)); |
result.write("\n\n"); |
} |
result.write("\n final messages = const {\n"); |