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

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: Yet more review cleanups 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 447ec9c47505ae51a7215d08857cea2e60355146..6d0666a0fd9542a1f37e4a790d4eda16da8b2094 100644
--- a/lib/i18n/date_format.dart
+++ b/lib/i18n/date_format.dart
@@ -3,10 +3,10 @@
* 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.
- * It allows the user to use any customized pattern to parse or format
- * date-time strings under certain locales. Date elements that vary across
+ * DateFormat is for formatting and parsing dates in a locale-sensitive
+ * manner.
+ * It allows 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
@@ -104,11 +104,19 @@
class DateFormat {
- /** Definition of this object formats dates. */
+ /** Definition of how this object formats dates.
Emily Fortuna 2012/06/05 22:34:17 the top line of this sort of comment should be bla
Alan Knight 2012/06/06 22:05:58 Done.
+ * (TODO) alanknight This might just be a String, but it's not clear yet.
+ */
var formatDefinition;
+ /** The locale we use to format dates.
Emily Fortuna 2012/06/05 22:34:17 same.
Alan Knight 2012/06/06 22:05:58 Done.
+ * (TODO) alanknight Is there a Locale type? Or is this just a string?
+ */
+ var locale;
+
+
/** Date/Time format patterns. */
- // TODO(alanknight): There's a style question of whether to use fullDate or
+ // TODO(alanknight): There's a style question of whether to use fullDate or
// FULL_DATE naming conventions.
static final int _fullDate = 0;
static final int _longDate = 1;
@@ -122,11 +130,9 @@ class DateFormat {
static final int _longDateTime = 9;
static final int _mediumDateTime = 10;
static final int _shortDateTime = 11;
-
+
/**
* Named constructors for each of the above values.
- * These could probably be made shorter if we just set the format to the
- * constant and the parsing was lazy.
*/
DateFormat.fullDate() : this.formatDefinition = _fullDate;
DateFormat.longDate() : this.formatDefinition = _longDate;
@@ -140,18 +146,28 @@ class DateFormat {
DateFormat.longDateTime() : this.formatDefinition = _longDateTime;
DateFormat.mediumDateTime() : this.formatDefinition = _mediumDateTime;
DateFormat.shortDateTime() : this.formatDefinition = _shortDateTime;
-
+
+ /**
+ * Explicit constructor given a particular format
+ */
DateFormat(this.formatDefinition);
/**
- *
+ * Constructors for dates/times that use a default format.
+ */
+ DateFormat.date([this.locale]) : formatDefinition = _fullDate;
+ DateFormat.time() : formatDefinition = _fullTime;
+ DateFormat.dateTime() : formatDefinition = _fullDateTime;
+
+ /**
+ *
*/
String parse(String inputString) {
return inputString;
}
/**
- * 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]) {
« 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