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

Side by Side Diff: intl/lib/src/date_format_internal.dart

Issue 1400473008: Roll Observatory packages and add a roll script (Closed) Base URL: git@github.com:dart-lang/observatory_pub_packages.git@master
Patch Set: Created 5 years, 2 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 unified diff | Download patch
« no previous file with comments | « intl/lib/src/data/dates/symbols/zu.json ('k') | intl/lib/src/file_data_reader.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4
5 /**
6 * This contains internal implementation details of the date formatting code
7 * which are exposed as public functions because they must be called by other
8 * libraries in order to configure the source for the locale data. We don't want
9 * them exposed as public API functions in the date formatting library, so they
10 * are put in a separate library here. These are for internal use only. User
11 * code should import one of the `date_symbol_data...` libraries and call the
12 * `initializeDateFormatting` method exposed there.
13 */
14
15 library date_format_internal;
16
17 import 'dart:async';
18 import 'intl_helpers.dart';
19 import '../date_symbols.dart';
20
21 /**
22 * This holds the symbols to be used for date/time formatting, indexed
23 * by locale. Note that it will be set differently during initialization,
24 * depending on what implementation we are using. By default, it is initialized
25 * to an instance of UninitializedLocaleData, so any attempt to use it will
26 * result in an informative error message.
27 */
28 var dateTimeSymbols = new UninitializedLocaleData(
29 'initializeDateFormatting(<locale>)', en_USSymbols);
30
31 /**
32 * This holds the patterns used for date/time formatting, indexed
33 * by locale. Note that it will be set differently during initialization,
34 * depending on what implementation we are using. By default, it is initialized
35 * to an instance of UninitializedLocaleData, so any attempt to use it will
36 * result in an informative error message.
37 */
38 var dateTimePatterns = new UninitializedLocaleData(
39 'initializeDateFormatting(<locale>)', en_USPatterns);
40
41 /**
42 * Initialize the symbols dictionary. This should be passed a function that
43 * creates and returns the symbol data. We take a function so that if
44 * initializing the data is an expensive operation it need only be done once,
45 * no matter how many times this method is called.
46 */
47 void initializeDateSymbols(Function symbols) {
48 if (dateTimeSymbols is UninitializedLocaleData) {
49 dateTimeSymbols = symbols();
50 }
51 }
52
53 /**
54 * Initialize the patterns dictionary. This should be passed a function that
55 * creates and returns the pattern data. We take a function so that if
56 * initializing the data is an expensive operation it need only be done once,
57 * no matter how many times this method is called.
58 */
59 void initializeDatePatterns(Function patterns) {
60 if (dateTimePatterns is UninitializedLocaleData) {
61 dateTimePatterns = patterns();
62 }
63 }
64
65 Future initializeIndividualLocaleDateFormatting(Function init) {
66 return init(dateTimeSymbols, dateTimePatterns);
67 }
OLDNEW
« no previous file with comments | « intl/lib/src/data/dates/symbols/zu.json ('k') | intl/lib/src/file_data_reader.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698