Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(306)

Unified Diff: sdk/lib/io/platform_impl.dart

Issue 2786183003: [dart:io] Reland: Adds Platform.localeName (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sdk/lib/io/platform.dart ('k') | tests/standalone/io/locale_name_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/io/platform_impl.dart
diff --git a/sdk/lib/io/platform_impl.dart b/sdk/lib/io/platform_impl.dart
index 5f68b7dbdef6ded8dc6ddaf263e8090d5ae94326..e5de17d02e52d6d18fe867ad5b0ac19a0c035c63 100644
--- a/sdk/lib/io/platform_impl.dart
+++ b/sdk/lib/io/platform_impl.dart
@@ -32,12 +32,25 @@ class _Platform {
external static String _packageRoot();
external static String _packageConfig();
external static String _version();
+ external static String _localeName();
static String executable = _executable();
static String resolvedExecutable = _resolvedExecutable();
static String packageRoot = _packageRoot();
static String packageConfig = _packageConfig();
+ static String _cachedLocaleName;
+ static String get localeName {
+ if (_cachedLocaleName == null) {
+ var result = _localeName();
+ if (result is OSError) {
+ throw result;
+ }
+ _cachedLocaleName = result;
+ }
+ return _cachedLocaleName;
+ }
+
// Cache the OS environment. This can be an OSError instance if
// retrieving the environment failed.
static var /*OSError|Map<String,String>*/ _environmentCache;
« no previous file with comments | « sdk/lib/io/platform.dart ('k') | tests/standalone/io/locale_name_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698