| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * A library for general helper code associated with the intl library | 6 * A library for general helper code associated with the intl library |
| 7 * rather than confined to specific parts of it. | 7 * rather than confined to specific parts of it. |
| 8 */ | 8 */ |
| 9 | 9 |
| 10 #library("intl_helpers"); | 10 #library("intl_helpers"); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 class LocaleDataException implements Exception { | 32 class LocaleDataException implements Exception { |
| 33 final String message; | 33 final String message; |
| 34 LocaleDataException(this.message); | 34 LocaleDataException(this.message); |
| 35 toString() => "LocaleDataException: $message"; | 35 toString() => "LocaleDataException: $message"; |
| 36 } | 36 } |
| 37 | 37 |
| 38 /** | 38 /** |
| 39 * An abstract superclass for data readers to keep the type system happy. | 39 * An abstract superclass for data readers to keep the type system happy. |
| 40 */ | 40 */ |
| 41 abstract class LocaleDataReader { | 41 abstract class LocaleDataReader { |
| 42 abstract Future read(String locale); | 42 Future read(String locale); |
| 43 } | 43 } |
| 44 | 44 |
| 45 /** | 45 /** |
| 46 * The internal mechanism for looking up messages. We expect this to be set | 46 * The internal mechanism for looking up messages. We expect this to be set |
| 47 * by the implementing package so that we're not dependent on its | 47 * by the implementing package so that we're not dependent on its |
| 48 * implementation. | 48 * implementation. |
| 49 */ | 49 */ |
| 50 var messageLookup = const | 50 var messageLookup = const |
| 51 UninitializedLocaleData('initializeMessages(<locale>)'); | 51 UninitializedLocaleData('initializeMessages(<locale>)'); |
| 52 | 52 |
| 53 /** | 53 /** |
| 54 * Initialize the message lookup mechanism. This is for internal use only. | 54 * Initialize the message lookup mechanism. This is for internal use only. |
| 55 * User applications should import `message_lookup_local.dart` and call | 55 * User applications should import `message_lookup_local.dart` and call |
| 56 * `initializeMessages` | 56 * `initializeMessages` |
| 57 */ | 57 */ |
| 58 void initializeInternalMessageLookup(Function lookupFunction) { | 58 void initializeInternalMessageLookup(Function lookupFunction) { |
| 59 if (messageLookup is UninitializedLocaleData) { | 59 if (messageLookup is UninitializedLocaleData) { |
| 60 messageLookup = lookupFunction(); | 60 messageLookup = lookupFunction(); |
| 61 } | 61 } |
| 62 } | 62 } |
| OLD | NEW |