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..a48006685fea5d94513606e594d3e9c720e0f314 |
| --- /dev/null |
| +++ b/lib/i18n/intl.dart |
| @@ -0,0 +1,59 @@ |
| +/** |
| + * 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. |
| + * |
| + */ |
| + |
| +#library('Intl'); |
| +#import('date_format.dart'); |
| +#import('message_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. |
| + */ |
| + var _locale; |
| + |
| + /** |
|
Emily Fortuna
2012/06/05 17:40:09
what happened on the indentation here? it looks li
Alan Knight
2012/06/05 21:47:34
Done.
|
| + * Constructor |
| + */ |
| + Intl([this._locale]); |
| + |
| + /** |
| + * Methods to return appropriate format objects. |
| + */ |
| + get date() => new DateFormat.date(); |
|
Emily Fortuna
2012/06/05 17:40:09
This this is a public API, let's explicitly list t
Alan Knight
2012/06/05 21:47:34
I notice that in the implementation, right now the
Emily Fortuna
2012/06/05 22:34:16
Absolutely. I hadn't harped on this much because I
Alan Knight
2012/06/06 22:05:58
OK, made them non-getters.
|
| + get time() => new DateFormat.time(); |
| + get dateTime() => new DateFormat.dateTime(); |
| + get message() => new MessageFormat(); |
| + |
| + /** |
| + * Support methods for message formatting. |
| + */ |
| + String plural(num howMany, Map actions) { |
| + var desiredKey = howMany.toString(); |
| + for (var key in actions.getKeys()) { |
| + if(desiredKey == key) {return actions[key];} |
|
Emily Fortuna
2012/06/05 17:40:09
no {} here either (consistency throughout the code
Alan Knight
2012/06/05 21:47:34
Done.
|
| + } |
| + if (actions.containsKey('other')) { |
| + return actions['other']; |
| + } else { |
| + return ''; |
| + } |
| + } |
| + |
| + String select(String choice, Map actions) { |
| + for (var key in actions.getKeys()) { |
| + if (choice == key) return actions[key]; |
| + } |
| + return ''; |
| + } |
| + |
| +} |