| 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'; | 16 import 'extract_messages.dart'; |
| 17 import 'src/intl_message.dart'; | 17 import 'src/intl_message.dart'; |
| 18 import 'dart:io'; | 18 import 'dart:io'; |
| 19 import 'package:pathos/path.dart' as path; | 19 import 'package:path/path.dart' as path; |
| 20 | 20 |
| 21 /** | 21 /** |
| 22 * If the import path following package: is something else, modify the | 22 * If the import path following package: is something else, modify the |
| 23 * [intlImportPath] variable to change the import directives in the generated | 23 * [intlImportPath] variable to change the import directives in the generated |
| 24 * code. | 24 * code. |
| 25 */ | 25 */ |
| 26 var intlImportPath = 'intl'; | 26 var intlImportPath = 'intl'; |
| 27 | 27 |
| 28 /** | 28 /** |
| 29 * If the path to the generated files is something other than the current | 29 * If the path to the generated files is something other than the current |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 messageLookup.addLocale(localeName, _findGeneratedMessagesFor); | 204 messageLookup.addLocale(localeName, _findGeneratedMessagesFor); |
| 205 return new Future.value(); | 205 return new Future.value(); |
| 206 } | 206 } |
| 207 | 207 |
| 208 MessageLookupByLibrary _findGeneratedMessagesFor(locale) { | 208 MessageLookupByLibrary _findGeneratedMessagesFor(locale) { |
| 209 var actualLocale = Intl.verifiedLocale(locale, (x) => _findExact(x) != null); | 209 var actualLocale = Intl.verifiedLocale(locale, (x) => _findExact(x) != null); |
| 210 if (actualLocale == null) return null; | 210 if (actualLocale == null) return null; |
| 211 return _findExact(actualLocale); | 211 return _findExact(actualLocale); |
| 212 } | 212 } |
| 213 """; | 213 """; |
| OLD | NEW |