|
4 | 4 |
|
5 | 5 | /// This provides facilities for Internationalization that are only available
|
6 | 6 | /// when running in the web browser. You should import only one of this or
|
7 |
| -/// intl_standalone.dart. Right now the only thing provided here is the |
8 |
| -/// ability to find the default locale from the browser. |
| 7 | +/// intl_standalone.dart. Right now the only thing provided here is the ability |
| 8 | +/// to find the default locale from the browser. |
9 | 9 | library;
|
10 | 10 |
|
11 |
| -import 'package:web/web.dart'; |
12 | 11 | import 'intl.dart';
|
| 12 | +import 'src/web.dart'; |
13 | 13 |
|
14 |
| -// TODO(alanknight): The need to do this by forcing the user to specially |
15 |
| -// import a particular library is a horrible hack, only done because there |
16 |
| -// seems to be no graceful way to do this at all. Either mirror access on |
17 |
| -// dart2js or the ability to do spawnUri in the browser would be promising |
18 |
| -// as ways to get rid of this requirement. |
19 |
| -/// Find the system locale, accessed as window.navigator.language, and |
20 |
| -/// set it as the default for internationalization operations in the |
21 |
| -/// [Intl.systemLocale] variable. |
| 14 | +// TODO(alanknight): The need to do this by forcing the user to specially import |
| 15 | +// a particular library is a horrible hack, only done because there seems to be |
| 16 | +// no graceful way to do this at all. Either mirror access on dart2js or the |
| 17 | +// ability to do spawnUri in the browser would be promising as ways to get rid |
| 18 | +// of this requirement. |
| 19 | + |
| 20 | +/// Find the system locale, accessed as window.navigator.language, and set it as |
| 21 | +/// the default for internationalization operations in the [Intl.systemLocale] |
| 22 | +/// variable. |
22 | 23 | Future<String> findSystemLocale() {
|
23 | 24 | Intl.systemLocale = Intl.canonicalizedLocale(window.navigator.language);
|
24 | 25 | return Future.value(Intl.systemLocale);
|
|
0 commit comments