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

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

Issue 20072002: Allow Intl.plural/gender as the top-level, omitting the Intl.message wrapper and the first layer of… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Changes from review Created 7 years, 5 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/src/intl_message.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/intl/lib/intl.dart
diff --git a/pkg/intl/lib/intl.dart b/pkg/intl/lib/intl.dart
index 8801031e1600c833706f2b89b98ce4b39c956549..b3fa55173a1610d14362f05c3867056097ba8b66 100644
--- a/pkg/intl/lib/intl.dart
+++ b/pkg/intl/lib/intl.dart
@@ -243,7 +243,19 @@ class Intl {
* Selects the correct plural form from
* the provided alternatives. The [other] named argument is mandatory.
*/
- static String plural(int howMany, {zero, one, two, few, many, other}) {
+ static String plural(int howMany, {zero, one, two, few, many, other,
+ desc, examples, locale, name, args}) {
+ // If we are passed a name and arguments, then we are operating as a
+ // top-level message, so look up our translation by calling Intl.message
+ // with ourselves as an argument.
+ if (name != null) {
+ return Intl.message(
+ Intl.plural(howMany,
+ zero: zero, one: one, two: two, few: few, many: many, other: other),
+ name: name,
+ args: args,
+ locale: locale);
+ }
if (other == null) {
throw new ArgumentError("The 'other' named argument must be provided");
}
@@ -265,7 +277,20 @@ class Intl {
* of an Intl.message message that is to be translated.
*/
static String gender(String gender,
- {String male, String female, String other}) {
+ {String male, String female, String other,
+ String desc, Map examples, String locale, String name,
+ List<String>args}) {
+ // If we are passed a name and arguments, then we are operating as a
+ // top-level message, so look up our translation by calling Intl.message
+ // with ourselves as an argument.
+ if (name != null) {
+ return Intl.message(
+ Intl.gender(gender, male: male, female: female, other: other),
+ name: name,
+ args: args,
+ locale: locale);
+ }
+
if (other == null) {
throw new ArgumentError("The 'other' named argument must be specified");
}
« no previous file with comments | « pkg/intl/lib/extract_messages.dart ('k') | pkg/intl/lib/src/intl_message.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698