Skip to content

Commit aa35e41

Browse files
cleanup
1 parent f064ba3 commit aa35e41

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

src/localize.android.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { vsprintf } from "sprintf-js";
2+
import { android as _android } from "tns-core-modules/application";
3+
import { getString, setString } from "tns-core-modules/application-settings";
4+
import { isAndroid } from "tns-core-modules/platform";
25
import * as utils from "tns-core-modules/utils/utils";
3-
import { getString, setString } from 'tns-core-modules/application-settings';
4-
import { isAndroid } from 'tns-core-modules/platform';
5-
import { android as _android } from 'tns-core-modules/application';
66

77
import { encodeKey } from "./resource";
88

@@ -30,7 +30,7 @@ export function localize(key: string, ...args: string[]): string {
3030
}
3131

3232
export function androidLaunchEventLocalizationHandler() {
33-
const lang = getString('__app__language__', 'none');
33+
const lang = getString("__app__language__", 'none');
3434
if (lang !== 'none' && isAndroid) {
3535
const locale = new java.util.Locale(lang);
3636
java.util.Locale.setDefault(locale);
@@ -44,7 +44,6 @@ export function androidLaunchEventLocalizationHandler() {
4444
}
4545

4646
export function overrideLocale(locale: string): boolean {
47-
setString('__app__language__', locale.substring(0, 2));
48-
47+
setString("__app__language__", locale.substring(0, 2));
4948
return true;
5049
}

src/localize.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
export declare function localize(key: string, ...args: string[]): string;
2+
23
export declare function overrideLocale(locale: string): boolean;
4+
35
export declare function androidLaunchEventLocalizationHandler(): void;

src/localize.ios.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { vsprintf } from "sprintf-js";
2+
import { setString } from "tns-core-modules/application-settings";
23

34
import { convertAtSignToStringSign } from "./placeholder";
45
import { encodeKey } from "./resource";
5-
import { setString } from "tns-core-modules/application-settings";
66

77
let bundle;
88

@@ -34,7 +34,7 @@ export function overrideLocale(locale: string): boolean {
3434
bundle = NSBundle.bundleWithPath(path);
3535
NSUserDefaults.standardUserDefaults.setObjectForKey([locale], "AppleLanguages");
3636
NSUserDefaults.standardUserDefaults.synchronize();
37-
setString('__app__language__', locale.substring(0, 2));
37+
setString("__app__language__", locale.substring(0, 2));
3838

3939
return true;
4040
}

0 commit comments

Comments
 (0)