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

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

Issue 10917069: Async initialization for DateFormat (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 3 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/date_format_internal.dart
===================================================================
--- pkg/intl/lib/date_format_internal.dart (revision 0)
+++ pkg/intl/lib/date_format_internal.dart (revision 0)
@@ -0,0 +1,55 @@
+// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
+// 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.
+
+/**
+ * This contains internal implementation details of the date formatting code
+ * which are split out into a separate library because they require public
Emily Fortuna 2012/09/04 20:14:42 "split out into separate libraries"?
Alan Knight 2012/09/04 23:39:03 I don't think so. The methods (plural) are split o
+ * functions (called across library boundaries) which are not part of a
+ * public API.
+ */
+
+#library('date_format_internal');
+#import('intl_helpers.dart');
+
+/**
+ * This holds the symbols to be used for date/time formatting, indexed
+ * by locale. Note that it will be set differently during initialization,
+ * depending on what implementation we are using. By default, it is initialized
+ * to an instance of UninitializedLocaleData, so any attempt to use it will
+ * result in an informative error message.
+ */
+var dateTimeSymbols =
+ const UninitializedLocaleData('initializeDateFormatting(<locale>)');
+
+/**
+ * This holds the patterns used for date/time formatting, indexed
+ * by locale. Note that it will be set differently during initialization,
+ * depending on what implementation we are using. By default, it is initialized
+ * to an instance of UninitializedLocaleData, so any attempt to use it will
+ * result in an informative error message.
+ */
+var dateTimePatterns =
+ const UninitializedLocaleData('initializeDateFormatting(<locale>)');
+
+/**
+ * Initialize the symbols dictionary.
Emily Fortuna 2012/09/04 20:14:42 Can you explain here how "symbols" is expected to
Alan Knight 2012/09/04 23:39:03 Done.
+ */
+void initializeDateSymbols(Function symbols) {
+ if (dateTimeSymbols is UninitializedLocaleData) {
+ dateTimeSymbols = symbols();
+ }
+}
+
+/// Initialize the patterns dictionary.
Emily Fortuna 2012/09/04 20:14:42 For sake of consistency, make this comment in the
Alan Knight 2012/09/04 23:39:03 Done.
+void initializeDatePatterns(Function patterns) {
+ if (dateTimePatterns is UninitializedLocaleData) {
+ dateTimePatterns = patterns();
+ }
+}
+
+/**
Emily Fortuna 2012/09/04 20:14:42 Either add a comment here or remove the comment no
Alan Knight 2012/09/04 23:39:03 Done.
+ */
+Future initializeIndividualLocaleDateFormatting(Function init) {
+ return init(dateTimeSymbols, dateTimePatterns);
+}

Powered by Google App Engine
This is Rietveld 408576698