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

Unified Diff: lib/i18n/date_format.dart

Issue 10494005: Updated message formatting to be more compatible with Dart string interpolation. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fixed up some merge errors, tweaked comments a little. Created 8 years, 6 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 | « no previous file | lib/i18n/intl.dart » ('j') | lib/i18n/intl.dart » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/i18n/date_format.dart
diff --git a/lib/i18n/date_format.dart b/lib/i18n/date_format.dart
index 47df761706a73f6f82f4c0b2005a97e03f94a337..14c4f00150fb60c8c1c064eee62aac746a18fb96 100644
--- a/lib/i18n/date_format.dart
+++ b/lib/i18n/date_format.dart
@@ -3,15 +3,15 @@
* for details. All rights reserved. Use of this source code is governed by a
* BSD-style license that can be found in the LICENSE file.
*
- * DateFormat is for formatting and parsing dates in a locale-sensitive
- * manner.
+ * DateFormat is for formatting and parsing dates in a locale-sensitive
+ * manner.
* It allows the user to choose from a set of standard date time formats as well
* as specify a customized pattern under certain locales. Date elements that
* vary across locales include month name, weekname, field, order, etc.
* //TODO(efortuna): Customized pattern system -- suggested by i18n needs
* // feedback on appropriateness.
- * We also allow the user to use any customized pattern to parse or format
- * date-time strings under certain locales. Date elements that vary across
+ * We also allow the user to use any customized pattern to parse or format
+ * date-time strings under certain locales. Date elements that vary across
* locales include month name, weekname, field, order, etc.
*
* This library uses the ICU/JDK date/time pattern specification as described
@@ -68,14 +68,14 @@
*
* Examples Using the US Locale:
*
- * Format Pattern Result
- * -------------- -------
- * "yyyy.MM.dd G 'at' HH:mm:ss vvvv"->1996.07.10 AD at 15:08:56 Pacific Time
- * "EEE, MMM d, ''yy" ->Wed, July 10, '96
- * "h:mm a" ->12:08 PM
- * "hh 'o''clock' a, zzzz" ->12 o'clock PM, Pacific Daylight Time
- * "K:mm a, vvv" ->0:00 PM, PT
- * "yyyyy.MMMMM.dd GGG hh:mm aaa" ->01996.July.10 AD 12:08 PM
+ * Format Pattern Result
+ * -------------- -------
+ * "yyyy.MM.dd G 'at' HH:mm:ss vvvv"->> 1996.07.10 AD at 15:08:56 Pacific Time
+ * "EEE, MMM d, ''yy" ->> Wed, July 10, '96
+ * "h:mm a" ->> 12:08 PM
+ * "hh 'o''clock' a, zzzz" ->> 12 o'clock PM, Pacific Daylight Time
+ * "K:mm a, vvv" ->> 0:00 PM, PT
+ * "yyyyy.MMMMM.dd GGG hh:mm aaa" ->> 01996.July.10 AD 12:08 PM
*
* When parsing a date string using the abbreviated year pattern ("yy"),
* DateTimeParse must interpret the abbreviated year relative to some
@@ -109,7 +109,10 @@
class DateFormat {
- /** Definition of this object formats dates. */
+ /**
+ * Definition of how this object formats dates.
+ * (TODO) alanknight This might just be a String, but it's not clear yet.
Emily Fortuna 2012/06/07 21:33:36 Move the TODO out of the doc comments into regular
Alan Knight 2012/06/07 21:58:53 Done.
+ */
var formatDefinition;
/**
@@ -118,7 +121,7 @@ class DateFormat {
*/
String _locale;
- /**
+ /**
* Date/Time format "skeleton" patterns. Also specifiable by String, but
* written this way so that they can be discoverable via autocomplete. These
* follow the ICU syntax described at the top of the file. These skeletons can
@@ -130,7 +133,7 @@ class DateFormat {
// Example of how this looks in the US
// locale.
static final String Hm = 'Hm'; // HH:mm
- static final String Hms = 'Hms'; // HH:mm:ss
+ static final String Hms = 'Hms'; // HH:mm:ss
static final String M = 'M'; // L
static final String MEd = 'MEd'; // E, M/d
static final String MMM = 'MMM'; // LLL
@@ -152,7 +155,7 @@ class DateFormat {
static final String yQQQ = 'yQQQ'; // QQQ yyyy
/** Date/Time format patterns. */
- // TODO(efortuna): This are just guesses of what a full date, long date is.
+ // TODO(efortuna): This are just guesses of what a full date, long date is.
// Do the proper homework on ICU to find the proper set "Hms"/"yMMd"
// applicable to each case.
static final String fullDate = '$y$MMMMd';
@@ -164,13 +167,14 @@ class DateFormat {
static final String mediumTime = Hms;
static final String shortTime = Hm;
static final String fullDateTime = '$fullDate$fullTime';
- static final String longDateTime = '$logDate$longTime';
+ static final String longDateTime = '$longDate$longTime';
static final String mediumDateTime = '$mediumDate$mediumTime';
static final String shortDateTime = '$shortDate$shortTime';
-
+
/**
- * Named constructors for the above values.
- */
+ * Constructors for dates/times that use a default format.
+ **/
Emily Fortuna 2012/06/07 21:33:36 remove extra asterisk, but replace with whitespace
Alan Knight 2012/06/07 21:58:53 Done.
+
Emily Fortuna 2012/06/07 21:33:36 remove extra whitespace line.
Alan Knight 2012/06/07 21:58:53 Done.
DateFormat.Hm([this._locale]) : formatDefinition = Hm;
DateFormat.Hms([this._locale]) : formatDefinition = Hms;
DateFormat.M([this._locale]) : formatDefinition = M;
@@ -205,7 +209,7 @@ class DateFormat {
DateFormat.longDateTime([this._locale]) : formatDefinition = longDateTime;
DateFormat.mediumDateTime([this._locale]) : formatDefinition = mediumDateTime;
DateFormat.shortDateTime([this._locale]) : formatDefinition = shortDateTime;
-
+
/**
* Constructor accepts a [formatDefinition], which can be a String, one of the
* predefined static forms, or a custom date format using the syntax described
@@ -224,7 +228,7 @@ class DateFormat {
}
/**
- * Format the given [date] object according to preset pattern and current
+ * Format the given [date] object according to preset pattern and current
* locale and return a formated string for the given date.
*/
String format(Date date, [TimeZone timeZone]) {
@@ -240,7 +244,7 @@ class DateFormat {
String formatDuration(Date reference) {
return '';
}
-
+
/**
* Formats a String indicating how long ago (negative [duration]) or how far
* in the future (positive [duration]) some time is with respect to a
« no previous file with comments | « no previous file | lib/i18n/intl.dart » ('j') | lib/i18n/intl.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698