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..9ba77696129a5970b18f9c18c91ef5f647d3a19e |
| --- /dev/null |
| +++ b/lib/i18n/intl.dart |
| @@ -0,0 +1,58 @@ |
| +/** |
| + * 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. |
|
Emily Fortuna
2012/06/07 21:33:36
move TODO out of doc comments.
Alan Knight
2012/06/07 21:58:53
Done.
|
| + */ |
| + var _locale; |
| + |
| + /** |
| + * Constructor |
| + */ |
| + Intl([this._locale]); |
| + |
| + /** |
| + * Methods to return appropriate format objects. |
| + */ |
|
Emily Fortuna
2012/06/07 21:33:36
add one more space so that this asterisk lines up
Alan Knight
2012/06/07 21:58:53
Done.
|
| + DateFormat date() => new DateFormat.fullDate(); |
| + DateFormat time() => new DateFormat.fullTime(); |
| + DateFormat dateTime() => new DateFormat.fullDateTime(); |
| + MessageFormat message() => new MessageFormat(); |
| + |
| + /** |
| + * Support methods for message formatting. |
| + */ |
| + String plural(num howMany, Map actions) { |
|
Emily Fortuna
2012/06/07 21:33:36
Now string is indented 3 spaces. Add back the spac
Alan Knight
2012/06/07 21:58:53
String looks correctly indented to me. It looks li
|
| + var desiredKey = howMany.toString(); |
| + for (var key in actions.getKeys()) { |
| + if(desiredKey == key) return actions[key]; |
| + } |
| + 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 ''; |
| + } |
| +} |