Open History to see the last commit
1diff --git a/dist/commonjs/condition-store/NativeConditionStore.js b/dist/commonjs/condition-store/NativeConditionStore.js
2index 83349e43d9cad0c02a5d076a56c66d7d26943206..ac31f5e92bdd3b9f1e3346e6800887bc85d934d3 100644
3--- a/dist/commonjs/condition-store/NativeConditionStore.js
4+++ b/dist/commonjs/condition-store/NativeConditionStore.js
5@@ -11,20 +11,21 @@ let _generaltranslation_react_core_pure = require("@generaltranslation/react-cor
6 */
7 var NativeConditionStore = class {
8 customReload;
9+ locale;
10 constructor(config) {
11 this.customReload = config._reload ?? (() => void 0);
12- this.updateLocale(config.locale ?? require_utils_getLocale.getLocale());
13+ this.locale = require_utils_resolveLocale.resolveLocale(config.locale ?? require_utils_getLocale.getLocale());
14+ require_utils_nativeStore.nativeStoreSet(getLocaleStoreKey(), this.locale);
15 const region = require_utils_getInitialNativeConditions.getInitialRegion({ region: config.region });
16 if (region !== void 0) this.updateRegion(region);
17 this.updateEnableI18n(require_utils_getInitialNativeConditions.getInitialEnableI18n({ enableI18n: config.enableI18n }));
18 }
19 getLocale = () => {
20- return require_utils_getLocale.getLocale();
21+ return this.locale;
22 };
23 setLocale = (locale) => {
24- const nextLocale = require_utils_resolveLocale.resolveLocale(locale);
25- require_utils_nativeStore.nativeStoreSet(getLocaleStoreKey(), nextLocale);
26- this.reload({ locale: nextLocale });
27+ this.updateLocale(locale);
28+ this.reload({ locale: this.locale });
29 };
30 getRegion = () => {
31 return require_utils_nativeStore.nativeStoreGet(getRegionStoreKey()) || void 0;
32@@ -41,7 +42,8 @@ var NativeConditionStore = class {
33 this.reload({ enableI18n });
34 };
35 updateLocale = (locale) => {
36- require_utils_nativeStore.nativeStoreSet(getLocaleStoreKey(), require_utils_resolveLocale.resolveLocale(locale));
37+ this.locale = require_utils_resolveLocale.resolveLocale(locale);
38+ require_utils_nativeStore.nativeStoreSet(getLocaleStoreKey(), this.locale);
39 };
40 updateRegion = (region) => {
41 require_utils_nativeStore.nativeStoreSet(getRegionStoreKey(), region ?? "");
42diff --git a/dist/module/condition-store/NativeConditionStore.js b/dist/module/condition-store/NativeConditionStore.js
43index aeadfee50fb03ee827b9326486eb39ef46b0921c..3d08229ee6acd065c868a14a8647343e37286121 100644
44--- a/dist/module/condition-store/NativeConditionStore.js
45+++ b/dist/module/condition-store/NativeConditionStore.js
46@@ -9,20 +9,21 @@ import { getI18nConfig } from "@generaltranslation/react-core/pure";
47 */
48 var NativeConditionStore = class {
49 customReload;
50+ locale;
51 constructor(config) {
52 this.customReload = config._reload ?? (() => void 0);
53- this.updateLocale(config.locale ?? getLocale());
54+ this.locale = resolveLocale(config.locale ?? getLocale());
55+ nativeStoreSet(getLocaleStoreKey(), this.locale);
56 const region = getInitialRegion({ region: config.region });
57 if (region !== void 0) this.updateRegion(region);
58 this.updateEnableI18n(getInitialEnableI18n({ enableI18n: config.enableI18n }));
59 }
60 getLocale = () => {
61- return getLocale();
62+ return this.locale;
63 };
64 setLocale = (locale) => {
65- const nextLocale = resolveLocale(locale);
66- nativeStoreSet(getLocaleStoreKey(), nextLocale);
67- this.reload({ locale: nextLocale });
68+ this.updateLocale(locale);
69+ this.reload({ locale: this.locale });
70 };
71 getRegion = () => {
72 return nativeStoreGet(getRegionStoreKey()) || void 0;
73@@ -39,7 +40,8 @@ var NativeConditionStore = class {
74 this.reload({ enableI18n });
75 };
76 updateLocale = (locale) => {
77- nativeStoreSet(getLocaleStoreKey(), resolveLocale(locale));
78+ this.locale = resolveLocale(locale);
79+ nativeStoreSet(getLocaleStoreKey(), this.locale);
80 };
81 updateRegion = (region) => {
82 nativeStoreSet(getRegionStoreKey(), region ?? "");
83diff --git a/src/condition-store/NativeConditionStore.ts b/src/condition-store/NativeConditionStore.ts
84index 3f300ed703db4d35e2118bbfe01430f370201f9e..18c3af21acaf3e6b4c7de2b8341c6847f8de1b73 100644
85--- a/src/condition-store/NativeConditionStore.ts
86+++ b/src/condition-store/NativeConditionStore.ts
87@@ -29,11 +29,14 @@ export type ReloadType = (state: NativeConditionStoreState) => void;
88 */
89 export class NativeConditionStore implements WritableConditionStoreInterface {
90 private customReload: ReloadType;
91+ private locale: string;
93 constructor(config: NativeConditionStoreParams) {
94 this.customReload = config._reload ?? (() => undefined);
96- this.updateLocale(config.locale ?? getLocale());
97+ // Android's void TurboModule setter writes asynchronously.
98+ this.locale = resolveLocale(config.locale ?? getLocale());
99+ nativeStoreSet(getLocaleStoreKey(), this.locale);
100 const region = getInitialRegion({
101 region: config.region,
102 });
103@@ -48,13 +51,12 @@ export class NativeConditionStore implements WritableConditionStoreInterface {
104 }
106 getLocale = (): string => {
107- return getLocale();
108+ return this.locale;
109 };
111 setLocale = (locale: LocaleCandidates): void => {
112- const nextLocale = resolveLocale(locale);
113- nativeStoreSet(getLocaleStoreKey(), nextLocale);
114- this.reload({ locale: nextLocale });
115+ this.updateLocale(locale);
116+ this.reload({ locale: this.locale });
117 };
119 getRegion = (): string | undefined => {
120@@ -76,7 +78,8 @@ export class NativeConditionStore implements WritableConditionStoreInterface {
121 };
123 updateLocale = (locale: LocaleCandidates): void => {
124- nativeStoreSet(getLocaleStoreKey(), resolveLocale(locale));
125+ this.locale = resolveLocale(locale);
126+ nativeStoreSet(getLocaleStoreKey(), this.locale);
127 };
129 updateRegion = (region: string | undefined): void => {