Chromium Code Reviews| Index: lib/i18n/intl.dart |
| diff --git a/lib/i18n/intl.dart b/lib/i18n/intl.dart |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..4144ec842898b71a4a4ac27324080d9d16036172 |
| --- /dev/null |
| +++ b/lib/i18n/intl.dart |
| @@ -0,0 +1,50 @@ |
| +/** |
| + * Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| + * for details. All rights reserved. Use of this source code is governed by a |
| + * BSD-style license that can be found in the LICENSE file. |
| + * |
| +**/ |
| + |
| + |
|
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.
|
| + |
| + |
| +#library('Intl'); |
| +#import('date_format.dart'); |
| + |
| +class Intl { |
| + |
| + /** |
| + * As yet not clearly defined variable for holding onto our current locale, |
| + * which may actually be a list of locales, or have different information |
| + * for different aspects of internationalization (e.g. German locale but with |
| + * Canadian date format) |
| + * 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.
|
| + */ |
| + var _locale; |
| + |
| + /** |
| + * Constructor |
| + **/ |
| + 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
|
| + Intl.locale(this._locale); |
| + |
| + /** |
| + * Methods to return appropriate format objects. |
| + **/ |
|
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.
|
| + get date() => new DateFormat.date(); |
| + get time() => new DateFormat.time(); |
| + get dateTime() => new DateFormat.dateTime(); |
| + get message() => new MessageFormat(); |
| + |
|
Emily Fortuna
2012/06/02 01:19:26
extra whitespace
Alan Knight
2012/06/02 02:19:44
Done.
|
| + |
| + /** |
| + * Support methods for message formatting. |
| + **/ |
| + 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
|
| + var desiredKey = howMany.toString(); |
| + for (var key in actions.getKeys()) { |
| + if(desiredKey == key) {return actions[key];} |
| + } |
| + return actions['other']; |
| + } |
| +} |