File tree Expand file tree Collapse file tree 3 files changed +25
-2
lines changed
Expand file tree Collapse file tree 3 files changed +25
-2
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ export class device implements definition.device {
1919 private static _deviceType : string ;
2020 private static _uuid : string ;
2121 private static _language : string ;
22+ private static _region : string ;
2223
2324 static get os ( ) : string {
2425 return platformNames . android ;
@@ -85,11 +86,19 @@ export class device implements definition.device {
8586
8687 static get language ( ) : string {
8788 if ( ! device . _language ) {
88- device . _language = java . util . Locale . getDefault ( ) . toString ( ) ;
89+ device . _language = java . util . Locale . getDefault ( ) . getLanguage ( ) ;
8990 }
9091
9192 return device . _language ;
9293 }
94+
95+ static get region ( ) : string {
96+ if ( ! device . _region ) {
97+ device . _region = java . util . Locale . getDefault ( ) . getCountry ( ) ;
98+ }
99+
100+ return device . _region ;
101+ }
93102}
94103
95104var mainScreen : MainScreen ;
Original file line number Diff line number Diff line change @@ -61,9 +61,14 @@ declare module "platform" {
6161 static uuid : string ;
6262
6363 /**
64- * Gets the preferred language. For example "en" or "en_US"
64+ * Gets the preferred language. For example "en"
6565 */
6666 static language : string ;
67+
68+ /**
69+ * Gets the preferred region. For example "US"
70+ */
71+ static region : string ;
6772 }
6873
6974 /**
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ export class device implements definition.device {
1515 private static _sdkVersion : string ;
1616 private static _deviceType : string ;
1717 private static _language : string ;
18+ private static _region : string ;
1819
1920 static get manufacturer ( ) : string {
2021 return "Apple" ;
@@ -84,6 +85,14 @@ export class device implements definition.device {
8485
8586 return device . _language ;
8687 }
88+
89+ static get region ( ) : string {
90+ if ( ! device . _region ) {
91+ device . _region = NSLocale . currentLocale ( ) . objectForKey ( NSLocaleCountryCode ) ;
92+ }
93+
94+ return device . _region ;
95+ }
8796}
8897
8998var mainScreen : MainScreen ;
You can’t perform that action at this time.
0 commit comments