|
|
Adds facilities for extracting Intl.message calls and generating code from translations
This adds both general libraries for extracting messages and generating translations and scripts for using them with a trivial translation format. It removes the previous mechanism in message_lookup_local that relied on mirrors and traversing libraries in favor of one with a more explicit lookup by library that's consistent with the generated code. It also changes the code in basic_example to use that.
It also includes a couple of other changes. It now uses pathos for path manipulation, and the data_directory.dart hack for running tests from multiple different places was cleaned up and made more general. In addition, Intl.message now returns a string rather than a Future, which was changed as part of the libv2 integration.
This version does not yet support the plural syntax, as it disallows any interpolations that aren't just replacing a variable name. It also doesn't support named arguments to functions containing Intl.message, and it doesn't yet have a mechanism for designating sections of a text as not being subject to translation.
Finally, it relies on analyzer-experimental, which has a different name in the repository and in pub. So this version will run in the repository but will not run if used from pub. Bug 9071 asks for the names to be made consistent.
Committed: https://code.google.com/p/dart/source/detail?r=20047
Total comments: 61
Total comments: 4
|
Unified diffs |
Side-by-side diffs |
Delta from patch set |
Stats (+1604 lines, -283 lines) |
Patch |
 |
M |
pkg/intl/example/basic/basic_example.dart
|
View
|
|
4 chunks |
+15 lines, -14 lines |
0 comments
|
Download
|
 |
M |
pkg/intl/example/basic/messages_all.dart
|
View
|
|
1 chunk |
+28 lines, -4 lines |
0 comments
|
Download
|
 |
M |
pkg/intl/example/basic/messages_de.dart
|
View
|
|
1 chunk |
+14 lines, -6 lines |
0 comments
|
Download
|
 |
M |
pkg/intl/example/basic/messages_th_th.dart
|
View
|
|
1 chunk |
+12 lines, -6 lines |
0 comments
|
Download
|
 |
M |
pkg/intl/example/basic/pubspec.yaml
|
View
|
|
1 chunk |
+2 lines, -7 lines |
0 comments
|
Download
|
 |
M |
pkg/intl/lib/date_symbol_data_file.dart
|
View
|
|
2 chunks |
+4 lines, -4 lines |
0 comments
|
Download
|
 |
A |
pkg/intl/lib/extract_messages.dart
|
View
|
1
|
1 chunk |
+332 lines, -0 lines |
0 comments
|
Download
|
 |
A |
pkg/intl/lib/generate_localized.dart
|
View
|
1
|
1 chunk |
+170 lines, -0 lines |
0 comments
|
Download
|
 |
M |
pkg/intl/lib/intl.dart
|
View
|
1
|
3 chunks |
+9 lines, -3 lines |
2 comments
|
Download
|
 |
A |
pkg/intl/lib/message_lookup_by_library.dart
|
View
|
1
|
1 chunk |
+140 lines, -0 lines |
0 comments
|
Download
|
 |
M |
pkg/intl/lib/message_lookup_local.dart
|
View
|
1
|
1 chunk |
+0 lines, -123 lines |
0 comments
|
Download
|
 |
M |
pkg/intl/lib/src/file_data_reader.dart
|
View
|
|
2 chunks |
+2 lines, -1 line |
0 comments
|
Download
|
 |
M |
pkg/intl/lib/src/intl_helpers.dart
|
View
|
1
|
2 chunks |
+7 lines, -1 line |
0 comments
|
Download
|
 |
A |
pkg/intl/lib/src/intl_message.dart
|
View
|
1
|
1 chunk |
+169 lines, -0 lines |
0 comments
|
Download
|
 |
M |
pkg/intl/pubspec.yaml
|
View
|
1
|
1 chunk |
+5 lines, -7 lines |
0 comments
|
Download
|
 |
M |
pkg/intl/test/data_directory.dart
|
View
|
1
|
1 chunk |
+32 lines, -10 lines |
0 comments
|
Download
|
 |
M |
pkg/intl/test/intl_message_basic_example_test.dart
|
View
|
1
|
1 chunk |
+0 lines, -2 lines |
0 comments
|
Download
|
 |
M |
pkg/intl/test/intl_message_test.dart
|
View
|
1
|
1 chunk |
+0 lines, -93 lines |
0 comments
|
Download
|
 |
A |
pkg/intl/test/message_extraction/extract_to_json.dart
|
View
|
1
|
1 chunk |
+67 lines, -0 lines |
0 comments
|
Download
|
 |
A |
pkg/intl/test/message_extraction/find_output_directory.dart
|
View
|
1
|
1 chunk |
+19 lines, -0 lines |
0 comments
|
Download
|
 |
A |
pkg/intl/test/message_extraction/generate_from_json.dart
|
View
|
1
|
1 chunk |
+97 lines, -0 lines |
0 comments
|
Download
|
 |
A |
pkg/intl/test/message_extraction/make_hardcoded_translation.dart
|
View
|
1
|
1 chunk |
+105 lines, -0 lines |
0 comments
|
Download
|
 |
A |
pkg/intl/test/message_extraction/message_extraction_test.dart
|
View
|
1
|
1 chunk |
+208 lines, -0 lines |
2 comments
|
Download
|
 |
A |
pkg/intl/test/message_extraction/part_of_sample_with_messages.dart
|
View
|
1
|
1 chunk |
+34 lines, -0 lines |
0 comments
|
Download
|
 |
A |
pkg/intl/test/message_extraction/sample_with_messages.dart
|
View
|
1
|
1 chunk |
+132 lines, -0 lines |
0 comments
|
Download
|
 |
M |
pkg/pkg.status
|
View
|
1
|
2 chunks |
+1 line, -2 lines |
0 comments
|
Download
|
Total messages: 6 (0 generated)
|