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

Side by Side Diff: pkg/intl/example/basic/basic_example.dart

Issue 22284003: pkg: analysis aided cleanup (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: nits Created 7 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « pkg/http_server/pubspec.yaml ('k') | pkg/intl/lib/generate_localized.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 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 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. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 /** 5 /**
6 * This provides a basic example of internationalization usage. It uses the 6 * This provides a basic example of internationalization usage. It uses the
7 * local variant of all the facilities, meaning that libraries with the 7 * local variant of all the facilities, meaning that libraries with the
8 * data for all the locales are directly imported by the program. Once lazy 8 * data for all the locales are directly imported by the program. Once lazy
9 * loading is available, we expect this to be the preferred mode, with 9 * loading is available, we expect this to be the preferred mode, with
10 * the initialization code actually loading the specific libraries needed. 10 * the initialization code actually loading the specific libraries needed.
11 * 11 *
12 * This defines messages for an English locale directly in the program and 12 * This defines messages for an English locale directly in the program and
13 * has separate libraries that define German and Thai messages that say more or 13 * has separate libraries that define German and Thai messages that say more or
14 * less the same thing, and prints the message with the date and time in it 14 * less the same thing, and prints the message with the date and time in it
15 * formatted appropriately for the locale. 15 * formatted appropriately for the locale.
16 */ 16 */
17 17
18 library intl_basic_example; 18 library intl_basic_example;
19 import 'dart:async'; 19 import 'dart:async';
20 import 'package:intl/date_symbol_data_local.dart'; 20 import 'package:intl/date_symbol_data_local.dart';
21 import 'package:intl/intl.dart'; 21 import 'package:intl/intl.dart';
22 import 'package:intl/message_lookup_by_library.dart';
23 import 'messages_all.dart'; 22 import 'messages_all.dart';
24 23
25 /** 24 /**
26 * In order to use this both as an example and as a test case, we pass in 25 * In order to use this both as an example and as a test case, we pass in
27 * the function for what we're going to do with the output. For a simple 26 * the function for what we're going to do with the output. For a simple
28 * example we just pass in [print] and for tests we pass in a function that 27 * example we just pass in [print] and for tests we pass in a function that
29 * adds it a list to be verified. 28 * adds it a list to be verified.
30 */ 29 */
31 Function doThisWithTheOutput; 30 Function doThisWithTheOutput;
32 31
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 doThisWithTheOutput(returnValue); 64 doThisWithTheOutput(returnValue);
66 } 65 }
67 66
68 printForLocale(aDate, intl, operation) { 67 printForLocale(aDate, intl, operation) {
69 var hmsFormat = intl.date().add_Hms(); 68 var hmsFormat = intl.date().add_Hms();
70 var dayFormat = intl.date().add_yMMMMEEEEd(); 69 var dayFormat = intl.date().add_yMMMMEEEEd();
71 var time = hmsFormat.format(aDate); 70 var time = hmsFormat.format(aDate);
72 var day = dayFormat.format(aDate); 71 var day = dayFormat.format(aDate);
73 Intl.withLocale(intl.locale, () => doThisWithTheOutput(operation(time,day))); 72 Intl.withLocale(intl.locale, () => doThisWithTheOutput(operation(time,day)));
74 } 73 }
OLDNEW
« no previous file with comments | « pkg/http_server/pubspec.yaml ('k') | pkg/intl/lib/generate_localized.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698