OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 * This provides utilities for generating localized versions of | 6 * This provides utilities for generating localized versions of |
7 * messages. It does not stand alone, but expects to be given | 7 * messages. It does not stand alone, but expects to be given |
8 * TranslatedMessage objects and generate code for a particular locale | 8 * TranslatedMessage objects and generate code for a particular locale |
9 * based on them. | 9 * based on them. |
10 * | 10 * |
11 * An example of usage can be found | 11 * An example of usage can be found |
12 * in test/message_extract/generate_from_json.dart | 12 * in test/message_extract/generate_from_json.dart |
13 */ | 13 */ |
14 library generate_localized; | 14 library generate_localized; |
15 | 15 |
16 import 'extract_messages.dart'; | |
17 import 'src/intl_message.dart'; | 16 import 'src/intl_message.dart'; |
18 import 'dart:io'; | 17 import 'dart:io'; |
19 import 'package:path/path.dart' as path; | 18 import 'package:path/path.dart' as path; |
20 | 19 |
21 /** | 20 /** |
22 * If the import path following package: is something else, modify the | 21 * If the import path following package: is something else, modify the |
23 * [intlImportPath] variable to change the import directives in the generated | 22 * [intlImportPath] variable to change the import directives in the generated |
24 * code. | 23 * code. |
25 */ | 24 */ |
26 var intlImportPath = 'intl'; | 25 var intlImportPath = 'intl'; |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 messageLookup.addLocale(localeName, _findGeneratedMessagesFor); | 203 messageLookup.addLocale(localeName, _findGeneratedMessagesFor); |
205 return new Future.value(); | 204 return new Future.value(); |
206 } | 205 } |
207 | 206 |
208 MessageLookupByLibrary _findGeneratedMessagesFor(locale) { | 207 MessageLookupByLibrary _findGeneratedMessagesFor(locale) { |
209 var actualLocale = Intl.verifiedLocale(locale, (x) => _findExact(x) != null); | 208 var actualLocale = Intl.verifiedLocale(locale, (x) => _findExact(x) != null); |
210 if (actualLocale == null) return null; | 209 if (actualLocale == null) return null; |
211 return _findExact(actualLocale); | 210 return _findExact(actualLocale); |
212 } | 211 } |
213 """; | 212 """; |
OLD | NEW |