| 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 * This provides facilities for Internationalization that are only available | 6 * This provides facilities for Internationalization that are only available |
| 7 * when running standalone. You should import only one of this or | 7 * when running standalone. You should import only one of this or |
| 8 * intl_browser.dart. Right now the only thing provided here is finding | 8 * intl_browser.dart. Right now the only thing provided here is finding |
| 9 * the operating system locale. | 9 * the operating system locale. |
| 10 */ | 10 */ |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 return _getAppleDefaults(); | 44 return _getAppleDefaults(); |
| 45 } | 45 } |
| 46 // We can't find anything, don't set the system locale and return null. | 46 // We can't find anything, don't set the system locale and return null. |
| 47 return new Future.immediate(null); | 47 return new Future.immediate(null); |
| 48 } | 48 } |
| 49 | 49 |
| 50 /** | 50 /** |
| 51 * Regular expression to match the expected output of systeminfo on | 51 * Regular expression to match the expected output of systeminfo on |
| 52 * Windows. e.g. System Locale:<tab>en_US;English (United States) | 52 * Windows. e.g. System Locale:<tab>en_US;English (United States) |
| 53 */ | 53 */ |
| 54 RegExp _sysInfoRegex = new RegExp(r"System Locale:\s+(\w\w-\w+);"); | 54 RegExp _sysInfoRegex = const RegExp(r"System Locale:\s+(\w\w-\w+);"); |
| 55 | 55 |
| 56 /** | 56 /** |
| 57 * Regular expression to match the expected output of reading the defaults | 57 * Regular expression to match the expected output of reading the defaults |
| 58 * database for AppleLanguages on Mac systems. | 58 * database for AppleLanguages on Mac systems. |
| 59 * e.g. { | 59 * e.g. { |
| 60 * en, | 60 * en, |
| 61 * "pt-PT", | 61 * "pt-PT", |
| 62 * ... | 62 * ... |
| 63 */ | 63 */ |
| 64 RegExp _appleDefaultsRegex = new RegExp(r'(\w\w_\w+)'); | 64 RegExp _appleDefaultsRegex = const RegExp(r'(\w\w_\w+)'); |
| 65 | 65 |
| 66 /** | 66 /** |
| 67 * Check to see if we have a "LANG" environment variable we can use and return | 67 * Check to see if we have a "LANG" environment variable we can use and return |
| 68 * it if found. Otherwise return null; | 68 * it if found. Otherwise return null; |
| 69 */ | 69 */ |
| 70 String _checkEnvironmentVariable() { | 70 String _checkEnvironmentVariable() { |
| 71 try { | 71 try { |
| 72 return Platform.environment['LANG']; | 72 return Platform.environment['LANG']; |
| 73 } catch (e) {}; | 73 } catch (e) {}; |
| 74 return null; | 74 return null; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 return new Future.immediate(locale); | 107 return new Future.immediate(locale); |
| 108 } | 108 } |
| 109 | 109 |
| 110 /** | 110 /** |
| 111 * Set [Intl.systemLocale] to be the canonicalizedLocale of [aLocale]. | 111 * Set [Intl.systemLocale] to be the canonicalizedLocale of [aLocale]. |
| 112 */ | 112 */ |
| 113 Future<String> _setLocale(aLocale) { | 113 Future<String> _setLocale(aLocale) { |
| 114 Intl.systemLocale = Intl.canonicalizedLocale(aLocale); | 114 Intl.systemLocale = Intl.canonicalizedLocale(aLocale); |
| 115 return new Future.immediate(Intl.systemLocale); | 115 return new Future.immediate(Intl.systemLocale); |
| 116 } | 116 } |
| OLD | NEW |