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

Unified Diff: lib/i18n/message_format.dart

Issue 10506006: Polish existing skeleton API. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 7 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: lib/i18n/message_format.dart
===================================================================
--- lib/i18n/message_format.dart (revision 8224)
+++ lib/i18n/message_format.dart (working copy)
@@ -38,17 +38,6 @@
class MessageFormat {
/**
- * Literal strings, including '', are replaced with \uFDDF_x_ for
- * parsing purposes, and recovered during format phase.
- * \uFDDF is a Unicode nonprinting character, not expected to be found in the
- * typical message.
- */
- final String _LITERAL_PLACEHOLDER = '\uFDDF_';
-
- /** String describing the use case for this message.*/
- final String _messageDescription;
-
- /**
* String that is used to determin the particular case and gender needed to be
* returned. The format of this string follows the same pattern as in Closure,
* Java, and C++. This pattern is described at the beginning of this class
@@ -57,13 +46,26 @@
final String _messageFunction;
/**
- * Constructor. Accepts a String [_messageDescription] describing the use case
- * for this string in the program, and a the String [_messageFunction] that is
- * used to determine the particular case and gender for the given instance.
+ * String indicating a language code with which the message is to be
+ * formatted (such as en-US).
*/
- const MessageFormat(this._messageDescription, this._messageFunction);
+ final String _locale;
/**
+ * Constructor. The constructor expects you do provide annotations in comments
+ * above your declaration of this constructor with an @desc describing the
+ * context for the useage of the function. You may also specify @ex to specify
+ * examples of inputs for each particular argument that the [_messageFunction]
+ * accepts. The String [_messageFunction] is used to determine the particular
+ * case and gender for the given instance. An optional [_locale] can be
+ * provided for specifics of the language locale to be used, otherwise, we
+ * will attempt to infer it (acceptable if Dart is running on the client, we
+ * can infer from the browser).
+ */
+ //TODO(efortuna): _locale is not currently inferred.
+ const MessageFormat(this._messageFunction, [this._locale = 'en-US']);
+
+ /**
* Formats a message. By default, we treat '#' with special meaning
* representing the number (plural_variable - plural_offset). If [ignorePound]
* is true, then we do not treat '#' as a special character, and it is just

Powered by Google App Engine
This is Rietveld 408576698