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

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

Issue 12733003: Adds facilities for extracting Intl.message calls and generating code from translations (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fixes from review comments, also made tests more robust, removed scheduled_test dependency 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
Index: pkg/intl/lib/intl.dart
diff --git a/pkg/intl/lib/intl.dart b/pkg/intl/lib/intl.dart
index 18af6a7fcf8bd72913f8d274d118903d5e3e86b7..968a38c24e39851732a651810182128bb3a44a11 100644
--- a/pkg/intl/lib/intl.dart
+++ b/pkg/intl/lib/intl.dart
@@ -43,19 +43,23 @@ part 'bidi_utils.dart';
* Usage examples:
* today(date) => Intl.message(
* "Today's date is $date",
+ * name: 'today',
+ * args: [date],
* desc: 'Indicate the current date',
* examples: {'date' : 'June 8, 2012'});
* print(today(new DateTime.now());
*
- * msg({num_people, place}) => Intl.message(
+ * msg(num_people, place) => Intl.message(
* '''I see ${Intl.plural(num_people,
* {'0': 'no one at all',
* '1': 'one other person',
* 'other': '$num_people other people'})} in $place.'''',
+ * name: 'msg',
+ * args: [num_people, place],
* desc: 'Description of how many people are seen as program start.',
* examples: {'num_people': 3, 'place': 'London'});
*
- * Calling `msg({'num_people': 2, 'place': 'Athens'});` would
+ * Calling `msg(2, 'Athens'});` would
Emily Fortuna 2013/03/14 19:45:00 nit: remove }
Alan Knight 2013/03/14 20:50:04 Done.
* produce "I see 2 other people in Athens." as output in the default locale.
*
* To use a locale other than the default, use the `withLocale` function.
@@ -128,7 +132,7 @@ class Intl {
* will be extracted automatically but for the time being it must be passed
* explicitly in the [name] and [args] arguments.
*/
- static Future<String> message(String message_str, {final String desc: '',
+ static String message(String message_str, {final String desc: '',
final Map examples: const {}, String locale, String name,
List<String> args}) {
return messageLookup.lookupMessage(
@@ -271,4 +275,6 @@ class Intl {
if (_defaultLocale == null) _defaultLocale = systemLocale;
return _defaultLocale;
}
+
+ toString() => "Intl($locale)";
}

Powered by Google App Engine
This is Rietveld 408576698