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

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: Merged up to head, and wasn't that fun 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.
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 18:42:23 remove extra astrisk.
Alan Knight 2012/06/07 21:19:39 Done.
32 get date() => new DateFormat.fullDate();
Emily Fortuna 2012/06/07 18:42:23 put return types for getters since this is an API.
Alan Knight 2012/06/07 21:19:39 Hmm, I'd made them non-getters. So that wasn't mer
33 get time() => new DateFormat.fullTime();
34 get dateTime() => new DateFormat.fullDateTime();
35 get message() => new MessageFormat();
36
37 /**
38 * Support methods for message formatting.
39 */
40 String plural(num howMany, Map actions) {
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'];
Emily Fortuna 2012/06/07 18:42:23 remove extra space here and below.
Alan Knight 2012/06/07 21:19:39 Done.
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
59 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698