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

Side by Side Diff: lib/i18n/intl.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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 /**
2 * Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
3 * for details. All rights reserved. Use of this source code is governed by a
4 * BSD-style license that can be found in the LICENSE file.
5 *
6 */
7
8 #library('Intl');
9 #import('date_format.dart');
10 #import('message_format.dart');
11
12 class Intl {
13
14 /**
15 * As yet not clearly defined variable for holding onto our current locale,
16 * which may actually be a list of locales, or have different information
17 * for different aspects of internationalization (e.g. German locale but with
18 * Canadian date format)
19 * TODO(alanknight) Actually make this class do something with locales,
20 * just a skeleton right now.
Emily Fortuna 2012/06/07 21:33:36 move TODO out of doc comments.
Alan Knight 2012/06/07 21:58:53 Done.
21 */
22 var _locale;
23
24 /**
25 * Constructor
26 */
27 Intl([this._locale]);
28
29 /**
30 * Methods to return appropriate format objects.
31 */
Emily Fortuna 2012/06/07 21:33:36 add one more space so that this asterisk lines up
Alan Knight 2012/06/07 21:58:53 Done.
32 DateFormat date() => new DateFormat.fullDate();
33 DateFormat time() => new DateFormat.fullTime();
34 DateFormat dateTime() => new DateFormat.fullDateTime();
35 MessageFormat message() => new MessageFormat();
36
37 /**
38 * Support methods for message formatting.
39 */
40 String plural(num howMany, Map actions) {
Emily Fortuna 2012/06/07 21:33:36 Now string is indented 3 spaces. Add back the spac
Alan Knight 2012/06/07 21:58:53 String looks correctly indented to me. It looks li
41 var desiredKey = howMany.toString();
42 for (var key in actions.getKeys()) {
43 if(desiredKey == key) return actions[key];
44 }
45 if (actions.containsKey('other')) {
46 return actions['other'];
47 } else {
48 return '';
49 }
50 }
51
52 String select(String choice, Map actions) {
53 for (var key in actions.getKeys()) {
54 if (choice == key) return actions[key];
55 }
56 return '';
57 }
58 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698