Chromium Code Reviews| OLD | NEW |
|---|---|
| (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; | |
|
Emily Fortuna
2012/06/05 00:30:39
this guy should be de-indented one space. It shoul
Alan Knight
2012/06/05 17:24:47
Done.
| |
| 23 | |
| 24 /** | |
| 25 * Constructor | |
| 26 */ | |
| 27 Intl([this._locale]); | |
| 28 | |
| 29 /** | |
| 30 * Methods to return appropriate format objects. | |
| 31 */ | |
| 32 get date() => new DateFormat.date(); | |
| 33 get time() => new DateFormat.time(); | |
| 34 get dateTime() => new DateFormat.dateTime(); | |
| 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'];} | |
| 47 else | |
|
Emily Fortuna
2012/06/05 00:30:39
Also, preferred formatting for this is:
if (blah)
Alan Knight
2012/06/05 17:24:47
Done.
| |
| 48 {return '';;}; | |
|
Emily Fortuna
2012/06/05 00:30:39
extra semicolon!
Alan Knight
2012/06/05 17:24:47
Done.
| |
| 49 } | |
| 50 | |
| 51 String select(String choice, Map actions) { | |
| 52 for (var key in actions.getKeys()) { | |
| 53 if (choice == key) {return actions[key];}; | |
|
Emily Fortuna
2012/06/05 00:30:39
the preferred format is if you have a one-line if
Alan Knight
2012/06/05 17:24:47
Done.
| |
| 54 return ''; | |
|
Emily Fortuna
2012/06/05 00:30:39
I think this return should be one line down -- oth
Alan Knight
2012/06/05 17:24:47
Oops.
Done.
| |
| 55 } | |
| 56 } | |
| 57 | |
| 58 } | |
| OLD | NEW |