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

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: Updated to reflect changes from review 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
11 class Intl {
12
13 /**
14 * As yet not clearly defined variable for holding onto our current locale,
15 * which may actually be a list of locales, or have different information
16 * for different aspects of internationalization (e.g. German locale but with
17 * Canadian date format)
18 * TODO(alanknight) Actually make this class do something with locales,
19 * just a skeleton right now.
20 */
21 var _locale;
22
23 /**
24 * Constructor
25 **/
Emily Fortuna 2012/06/04 23:34:52 get rid of extra astrisk here
Alan Knight 2012/06/05 00:16:46 Done.
26 Intl([this._locale]);
27
28 /**
29 * Methods to return appropriate format objects.
30 */
Emily Fortuna 2012/06/04 23:34:52 indent one more space here.
Alan Knight 2012/06/05 00:16:46 Done.
31 get date() => new DateFormat.date();
32 get time() => new DateFormat.time();
33 get dateTime() => new DateFormat.dateTime();
34 get message() => new MessageFormat();
35
36 /**
37 * Support methods for message formatting.
38 */
39 String plural(num howMany, Map actions) {
Emily Fortuna 2012/06/04 23:34:52 one more space here
Alan Knight 2012/06/05 00:16:46 Done.
40 var desiredKey = howMany.toString();
41 for (var key in actions.getKeys()) {
42 if(desiredKey == key) {return actions[key];}
43 }
44 if (actions.containsKey('other'))
45 {return actions['other'];}
46 else
47 {return "";};
Emily Fortuna 2012/06/04 23:34:52 nit: up above you use the single quotes for string
Alan Knight 2012/06/05 00:16:46 Done.
48 }
49
50 String select(String choice, Map actions) {
51 for (var key in actions.getKeys()) {
52 if (choice == key) {return actions[key]};
53 return "";
Emily Fortuna 2012/06/04 23:34:52 same here
Alan Knight 2012/06/05 00:16:46 Done.
54 }
55 }
56
57 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698