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

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: 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
Emily Fortuna 2012/06/02 01:19:26 get rid of extra whitespace (one or 2 lines only)
Alan Knight 2012/06/02 02:19:44 Done.
9
10
11 #library('Intl');
12 #import('date_format.dart');
13
14 class Intl {
15
16 /**
17 * As yet not clearly defined variable for holding onto our current locale,
18 * which may actually be a list of locales, or have different information
19 * for different aspects of internationalization (e.g. German locale but with
20 * Canadian date format)
21 * TODO(alanknight) Actually make this class do something with locales, just a skeleton right now.
Emily Fortuna 2012/06/02 01:19:26 line break this line so it's less than 80 char
Alan Knight 2012/06/02 02:19:44 Done.
22 */
23 var _locale;
24
25 /**
26 * Constructor
27 **/
28 Intl();
Emily Fortuna 2012/06/02 01:19:26 How about instead of the named constructor, do: In
Alan Knight 2012/06/02 02:19:44 Ah, I didn't realize you could do that without mak
Alan Knight 2012/06/02 02:19:44 Cool. I didn't realize you could do that without f
29 Intl.locale(this._locale);
30
31 /**
32 * Methods to return appropriate format objects.
33 **/
Emily Fortuna 2012/06/02 01:19:26 nits: ending comment line is */ not **/ (yes, we'r
Alan Knight 2012/06/02 02:19:44 Done.
Alan Knight 2012/06/02 02:19:44 Done. And fixed in various other places.
34 get date() => new DateFormat.date();
35 get time() => new DateFormat.time();
36 get dateTime() => new DateFormat.dateTime();
37 get message() => new MessageFormat();
38
Emily Fortuna 2012/06/02 01:19:26 extra whitespace
Alan Knight 2012/06/02 02:19:44 Done.
39
40 /**
41 * Support methods for message formatting.
42 **/
43 String plural(num howMany, Map actions) {
Emily Fortuna 2012/06/02 01:19:26 Can we add a select method, here, too? It can be d
Alan Knight 2012/06/02 02:19:44 Done. Also added a check to plural that if the 'ot
44 var desiredKey = howMany.toString();
45 for (var key in actions.getKeys()) {
46 if(desiredKey == key) {return actions[key];}
47 }
48 return actions['other'];
49 }
50 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698