diff --git a/platform/platform.android.ts b/platform/platform.android.ts index 69f008092..148d5bcab 100644 --- a/platform/platform.android.ts +++ b/platform/platform.android.ts @@ -19,6 +19,7 @@ export class device implements definition.device { private static _deviceType: string; private static _uuid: string; private static _language: string; + private static _region: string; static get os(): string { return platformNames.android; @@ -85,11 +86,19 @@ export class device implements definition.device { static get language(): string { if (!device._language) { - device._language = java.util.Locale.getDefault().toString(); + device._language = java.util.Locale.getDefault().getLanguage(); } return device._language; } + + static get region(): string { + if(!device._region) { + device._region = java.util.Locale.getDefault().getCountry(); + } + + return device._region; + } } var mainScreen: MainScreen; diff --git a/platform/platform.d.ts b/platform/platform.d.ts index ddae89346..21f639f84 100644 --- a/platform/platform.d.ts +++ b/platform/platform.d.ts @@ -61,9 +61,14 @@ declare module "platform" { static uuid: string; /** - * Gets the preferred language. For example "en" or "en_US" + * Gets the preferred language. For example "en" */ static language: string; + + /** + * Gets the preferred region. For example "US" + */ + static region: string; } /** diff --git a/platform/platform.ios.ts b/platform/platform.ios.ts index 1f76a58c5..d5e0c3a32 100644 --- a/platform/platform.ios.ts +++ b/platform/platform.ios.ts @@ -15,6 +15,7 @@ export class device implements definition.device { private static _sdkVersion: string; private static _deviceType: string; private static _language: string; + private static _region: string; static get manufacturer(): string { return "Apple"; @@ -84,6 +85,14 @@ export class device implements definition.device { return device._language; } + + static get region(): string { + if(!device._region) { + device._region = NSLocale.currentLocale().objectForKey(NSLocaleCountryCode); + } + + return device._region; + } } var mainScreen: MainScreen;