@tyrads.com/tyrads-sdk 2.0.0-beta.2 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +11 -11
- package/android/build.gradle +117 -117
- package/android/gradle.properties +5 -5
- package/android/src/main/AndroidManifest.xml +3 -3
- package/android/src/main/AndroidManifestNew.xml +2 -2
- package/android/src/main/java/com/tyradssdk/TyradsSdkComposeViewManager.kt +112 -112
- package/android/src/main/java/com/tyradssdk/TyradsSdkModule.kt +56 -56
- package/android/src/main/java/com/tyradssdk/TyradsSdkPackage.kt +18 -21
- package/ios/Tyrads/AcmoConfig.swift +32 -31
- package/ios/Tyrads/ApiHeaders.swift +12 -0
- package/ios/Tyrads/InitModel.swift +48 -46
- package/ios/Tyrads/Tyrads.swift +199 -176
- package/ios/TyradsSdk-Bridging-Header.h +2 -2
- package/ios/TyradsSdk.mm +14 -11
- package/ios/TyradsSdk.swift +47 -27
- package/lib/commonjs/acmo/core/marquee.js.map +1 -1
- package/lib/commonjs/acmo/core/storage/storage.js.map +1 -1
- package/lib/commonjs/acmo/core/types/types.d.js.map +1 -1
- package/lib/commonjs/acmo/modules/dashboard/components/auto_scroller.js.map +1 -1
- package/lib/commonjs/acmo/modules/dashboard/components/custom_card.js.map +1 -1
- package/lib/commonjs/acmo/modules/dashboard/components/my_games_button.js +3 -5
- package/lib/commonjs/acmo/modules/dashboard/components/my_games_button.js.map +1 -1
- package/lib/commonjs/acmo/modules/dashboard/components/offer_info_section.js +3 -8
- package/lib/commonjs/acmo/modules/dashboard/components/offer_info_section.js.map +1 -1
- package/lib/commonjs/acmo/modules/dashboard/components/premium_header.js +3 -3
- package/lib/commonjs/acmo/modules/dashboard/components/premium_header.js.map +1 -1
- package/lib/commonjs/acmo/modules/dashboard/components/premium_option_1.js +2 -7
- package/lib/commonjs/acmo/modules/dashboard/components/premium_option_1.js.map +1 -1
- package/lib/commonjs/acmo/modules/dashboard/components/premium_option_2.js +4 -6
- package/lib/commonjs/acmo/modules/dashboard/components/premium_option_2.js.map +1 -1
- package/lib/commonjs/acmo/modules/dashboard/components/premium_option_3.js +4 -6
- package/lib/commonjs/acmo/modules/dashboard/components/premium_option_3.js.map +1 -1
- package/lib/commonjs/acmo/modules/dashboard/components/premium_option_4.js +5 -6
- package/lib/commonjs/acmo/modules/dashboard/components/premium_option_4.js.map +1 -1
- package/lib/commonjs/acmo/modules/dashboard/repository.js.map +1 -1
- package/lib/commonjs/acmo/modules/dashboard/top_offers.js +23 -7
- package/lib/commonjs/acmo/modules/dashboard/top_offers.js.map +1 -1
- package/lib/commonjs/i18n.js.map +1 -1
- package/lib/commonjs/index.js +12 -2
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/acmo/core/marquee.js.map +1 -1
- package/lib/module/acmo/core/storage/storage.js.map +1 -1
- package/lib/module/acmo/core/types/types.d.js.map +1 -1
- package/lib/module/acmo/modules/dashboard/components/auto_scroller.js.map +1 -1
- package/lib/module/acmo/modules/dashboard/components/custom_card.js.map +1 -1
- package/lib/module/acmo/modules/dashboard/components/my_games_button.js +3 -5
- package/lib/module/acmo/modules/dashboard/components/my_games_button.js.map +1 -1
- package/lib/module/acmo/modules/dashboard/components/offer_info_section.js +3 -8
- package/lib/module/acmo/modules/dashboard/components/offer_info_section.js.map +1 -1
- package/lib/module/acmo/modules/dashboard/components/premium_header.js +3 -3
- package/lib/module/acmo/modules/dashboard/components/premium_header.js.map +1 -1
- package/lib/module/acmo/modules/dashboard/components/premium_option_1.js +2 -7
- package/lib/module/acmo/modules/dashboard/components/premium_option_1.js.map +1 -1
- package/lib/module/acmo/modules/dashboard/components/premium_option_2.js +4 -6
- package/lib/module/acmo/modules/dashboard/components/premium_option_2.js.map +1 -1
- package/lib/module/acmo/modules/dashboard/components/premium_option_3.js +4 -6
- package/lib/module/acmo/modules/dashboard/components/premium_option_3.js.map +1 -1
- package/lib/module/acmo/modules/dashboard/components/premium_option_4.js +5 -6
- package/lib/module/acmo/modules/dashboard/components/premium_option_4.js.map +1 -1
- package/lib/module/acmo/modules/dashboard/repository.js.map +1 -1
- package/lib/module/acmo/modules/dashboard/top_offers.js +23 -7
- package/lib/module/acmo/modules/dashboard/top_offers.js.map +1 -1
- package/lib/module/i18n.js.map +1 -1
- package/lib/module/index.js +12 -2
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/commonjs/src/acmo/core/storage/storage.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/my_games_button.d.ts +1 -0
- package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/my_games_button.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/offer_info_section.d.ts +1 -0
- package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/offer_info_section.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/premium_header.d.ts +1 -0
- package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/premium_header.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/premium_option_1.d.ts +1 -0
- package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/premium_option_1.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/premium_option_2.d.ts +1 -0
- package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/premium_option_2.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/premium_option_3.d.ts +1 -0
- package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/premium_option_3.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/premium_option_4.d.ts +1 -0
- package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/premium_option_4.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/acmo/modules/dashboard/repository.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/acmo/modules/dashboard/top_offers.d.ts +1 -0
- package/lib/typescript/commonjs/src/acmo/modules/dashboard/top_offers.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
- package/lib/typescript/module/src/acmo/core/storage/storage.d.ts.map +1 -1
- package/lib/typescript/module/src/acmo/modules/dashboard/components/my_games_button.d.ts +1 -0
- package/lib/typescript/module/src/acmo/modules/dashboard/components/my_games_button.d.ts.map +1 -1
- package/lib/typescript/module/src/acmo/modules/dashboard/components/offer_info_section.d.ts +1 -0
- package/lib/typescript/module/src/acmo/modules/dashboard/components/offer_info_section.d.ts.map +1 -1
- package/lib/typescript/module/src/acmo/modules/dashboard/components/premium_header.d.ts +1 -0
- package/lib/typescript/module/src/acmo/modules/dashboard/components/premium_header.d.ts.map +1 -1
- package/lib/typescript/module/src/acmo/modules/dashboard/components/premium_option_1.d.ts +1 -0
- package/lib/typescript/module/src/acmo/modules/dashboard/components/premium_option_1.d.ts.map +1 -1
- package/lib/typescript/module/src/acmo/modules/dashboard/components/premium_option_2.d.ts +1 -0
- package/lib/typescript/module/src/acmo/modules/dashboard/components/premium_option_2.d.ts.map +1 -1
- package/lib/typescript/module/src/acmo/modules/dashboard/components/premium_option_3.d.ts +1 -0
- package/lib/typescript/module/src/acmo/modules/dashboard/components/premium_option_3.d.ts.map +1 -1
- package/lib/typescript/module/src/acmo/modules/dashboard/components/premium_option_4.d.ts +1 -0
- package/lib/typescript/module/src/acmo/modules/dashboard/components/premium_option_4.d.ts.map +1 -1
- package/lib/typescript/module/src/acmo/modules/dashboard/repository.d.ts.map +1 -1
- package/lib/typescript/module/src/acmo/modules/dashboard/top_offers.d.ts +1 -0
- package/lib/typescript/module/src/acmo/modules/dashboard/top_offers.d.ts.map +1 -1
- package/lib/typescript/module/src/index.d.ts.map +1 -1
- package/package.json +197 -197
- package/readme.md +95 -97
- package/src/acmo/core/marquee.tsx +61 -61
- package/src/acmo/core/storage/storage.ts +27 -27
- package/src/acmo/core/types/types.d.ts +93 -93
- package/src/acmo/modules/dashboard/components/auto_scroller.tsx +84 -84
- package/src/acmo/modules/dashboard/components/custom_card.tsx +30 -30
- package/src/acmo/modules/dashboard/components/my_games_button.tsx +39 -39
- package/src/acmo/modules/dashboard/components/offer_info_section.tsx +138 -143
- package/src/acmo/modules/dashboard/components/premium_header.tsx +80 -80
- package/src/acmo/modules/dashboard/components/premium_option_1.tsx +155 -160
- package/src/acmo/modules/dashboard/components/premium_option_2.tsx +99 -103
- package/src/acmo/modules/dashboard/components/premium_option_3.tsx +41 -45
- package/src/acmo/modules/dashboard/components/premium_option_4.tsx +184 -183
- package/src/acmo/modules/dashboard/repository.ts +94 -94
- package/src/acmo/modules/dashboard/top_offers.tsx +144 -131
- package/src/i18n.ts +114 -114
- package/src/index.tsx +89 -81
- package/tyrads-sdk.podspec +41 -41
@@ -1,131 +1,144 @@
|
|
1
|
-
import React, { useState, useEffect } from 'react';
|
2
|
-
import {
|
3
|
-
View,
|
4
|
-
Text,
|
5
|
-
ActivityIndicator,
|
6
|
-
StyleSheet,
|
7
|
-
} from 'react-native';
|
8
|
-
import { fetchCampaignsData } from './repository';
|
9
|
-
import PremiumHeaderSection from './components/premium_header';
|
10
|
-
import CustomCard from './components/custom_card';
|
11
|
-
import MyGamesButton from './components/my_games_button';
|
12
|
-
import PremiumOption1 from './components/premium_option_1';
|
13
|
-
import PremiumOption2 from './components/premium_option_2';
|
14
|
-
import PremiumOption3 from './components/premium_option_3';
|
15
|
-
import PremiumOption4 from './components/premium_option_4';
|
16
|
-
|
17
|
-
interface TopOffersProps {
|
18
|
-
showMore?: boolean;
|
19
|
-
showMyOffers?: boolean;
|
20
|
-
showMyOffersEmptyView?: boolean;
|
21
|
-
style?: number;
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
const [
|
33
|
-
const [
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
<View style={styles.
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
}
|
130
|
-
|
131
|
-
|
1
|
+
import React, { useState, useEffect } from 'react';
|
2
|
+
import {
|
3
|
+
View,
|
4
|
+
Text,
|
5
|
+
ActivityIndicator,
|
6
|
+
StyleSheet,
|
7
|
+
} from 'react-native';
|
8
|
+
import { fetchCampaignsData } from './repository';
|
9
|
+
import PremiumHeaderSection from './components/premium_header';
|
10
|
+
import CustomCard from './components/custom_card';
|
11
|
+
import MyGamesButton from './components/my_games_button';
|
12
|
+
import PremiumOption1 from './components/premium_option_1';
|
13
|
+
import PremiumOption2 from './components/premium_option_2';
|
14
|
+
import PremiumOption3 from './components/premium_option_3';
|
15
|
+
import PremiumOption4 from './components/premium_option_4';
|
16
|
+
|
17
|
+
interface TopOffersProps {
|
18
|
+
showMore?: boolean;
|
19
|
+
showMyOffers?: boolean;
|
20
|
+
showMyOffersEmptyView?: boolean;
|
21
|
+
style?: number;
|
22
|
+
onNavigate: (route?: string, campaignID?: number) => void;
|
23
|
+
}
|
24
|
+
|
25
|
+
const TopOffers: React.FC<TopOffersProps> = ({
|
26
|
+
showMore,
|
27
|
+
showMyOffers = false,
|
28
|
+
showMyOffersEmptyView = false,
|
29
|
+
style = 1,
|
30
|
+
onNavigate
|
31
|
+
}) => {
|
32
|
+
const [campaigns, setCampaigns] = useState<TransformedCampaign[]>([]);
|
33
|
+
const [isLoading, setIsLoading] = useState<boolean>(true);
|
34
|
+
const [error, setError] = useState<string | null>(null);
|
35
|
+
const [premiumColor, setPremiumColor] = useState<string>('#1C90DF');
|
36
|
+
// const [language, setLanguage] = useState<string>('en');
|
37
|
+
|
38
|
+
useEffect(() => {
|
39
|
+
fetchCampaignsData(
|
40
|
+
// setLanguage,
|
41
|
+
setPremiumColor,
|
42
|
+
setCampaigns,
|
43
|
+
setError,
|
44
|
+
setIsLoading
|
45
|
+
);
|
46
|
+
}, []);
|
47
|
+
|
48
|
+
const handleShowOffers = () => {
|
49
|
+
onNavigate();
|
50
|
+
};
|
51
|
+
const handleCampaignPress = (campaignId: number) => {
|
52
|
+
onNavigate('campaign-details',campaignId );
|
53
|
+
};
|
54
|
+
|
55
|
+
const handleMoreOffersPress = (route: string) => {
|
56
|
+
onNavigate(route);
|
57
|
+
};
|
58
|
+
|
59
|
+
if (isLoading) {
|
60
|
+
return (
|
61
|
+
<View style={styles.loadingContainer}>
|
62
|
+
<ActivityIndicator size="large" color="#007AFF" />
|
63
|
+
</View>
|
64
|
+
);
|
65
|
+
}
|
66
|
+
|
67
|
+
if (error) {
|
68
|
+
return (
|
69
|
+
<View style={styles.errorContainer}>
|
70
|
+
<Text style={styles.errorText}>Error: {error}</Text>
|
71
|
+
</View>
|
72
|
+
);
|
73
|
+
}
|
74
|
+
|
75
|
+
if (campaigns.length === 0) {
|
76
|
+
if (showMyOffersEmptyView) {
|
77
|
+
return (
|
78
|
+
<View style={styles.noCampaignContainer}>
|
79
|
+
<Text>No campaigns available</Text>
|
80
|
+
</View>
|
81
|
+
);
|
82
|
+
} else {
|
83
|
+
return <View />;
|
84
|
+
}
|
85
|
+
}
|
86
|
+
|
87
|
+
return (
|
88
|
+
<CustomCard style={{}}>
|
89
|
+
<View style={{ flex: 1 }}>
|
90
|
+
<PremiumHeaderSection showMore={showMore} premiumColor={premiumColor} onShowOffers={handleShowOffers} />
|
91
|
+
<View style={styles.headerSpacer} />
|
92
|
+
{(() => {
|
93
|
+
switch (style) {
|
94
|
+
case 1:
|
95
|
+
return (
|
96
|
+
<PremiumOption1 data={campaigns} premiumColor={premiumColor} onCampaignPress={handleCampaignPress} />
|
97
|
+
);
|
98
|
+
case 2:
|
99
|
+
return (
|
100
|
+
<PremiumOption2 data={campaigns} premiumColor={premiumColor} onCampaignPress={handleCampaignPress} />
|
101
|
+
);
|
102
|
+
case 3:
|
103
|
+
return (
|
104
|
+
<PremiumOption3 data={campaigns} premiumColor={premiumColor} onCampaignPress={handleCampaignPress} />
|
105
|
+
);
|
106
|
+
case 4:
|
107
|
+
return (
|
108
|
+
<PremiumOption4 data={campaigns} premiumColor={premiumColor} onCampaignPress={handleCampaignPress} />
|
109
|
+
);
|
110
|
+
default:
|
111
|
+
return <Text>Please specify a correct style</Text>;
|
112
|
+
}
|
113
|
+
})()}
|
114
|
+
<View style={styles.gameListSpacer} />
|
115
|
+
{showMyOffers && <MyGamesButton premiumColor={premiumColor} onPress={handleMoreOffersPress}/>}
|
116
|
+
</View>
|
117
|
+
</CustomCard>
|
118
|
+
);
|
119
|
+
};
|
120
|
+
|
121
|
+
const styles = StyleSheet.create({
|
122
|
+
loadingContainer: {
|
123
|
+
flex: 1,
|
124
|
+
justifyContent: 'center',
|
125
|
+
alignItems: 'center',
|
126
|
+
},
|
127
|
+
errorContainer: {
|
128
|
+
padding: 16,
|
129
|
+
},
|
130
|
+
errorText: {
|
131
|
+
color: 'red',
|
132
|
+
},
|
133
|
+
noCampaignContainer: {
|
134
|
+
padding: 16,
|
135
|
+
},
|
136
|
+
headerSpacer: {
|
137
|
+
height: 10,
|
138
|
+
},
|
139
|
+
gameListSpacer: {
|
140
|
+
height: 10,
|
141
|
+
},
|
142
|
+
});
|
143
|
+
|
144
|
+
export default TopOffers;
|
package/src/i18n.ts
CHANGED
@@ -1,115 +1,115 @@
|
|
1
|
-
import i18n from 'i18next';
|
2
|
-
import { initReactI18next } from 'react-i18next';
|
3
|
-
import AsyncStorage from '@react-native-async-storage/async-storage';
|
4
|
-
|
5
|
-
|
6
|
-
const resources = {
|
7
|
-
en: {
|
8
|
-
translation: {
|
9
|
-
"dashboard": {
|
10
|
-
"suggested_offers": "Suggested Offers",
|
11
|
-
"more_offers": "More Offers",
|
12
|
-
"my_games": "My Games",
|
13
|
-
"play_button": "Play Now",
|
14
|
-
"top_ranking": "Top {{number}}",
|
15
|
-
"rewards_one": "Reward",
|
16
|
-
"rewards_other": "Rewards"
|
17
|
-
},
|
18
|
-
|
19
|
-
|
20
|
-
}
|
21
|
-
},
|
22
|
-
es: {
|
23
|
-
translation: {
|
24
|
-
"dashboard": {
|
25
|
-
"suggested_offers": "Ofertas sugeridas",
|
26
|
-
"more_offers": "Más ofertas",
|
27
|
-
"my_games": "Mis juegos",
|
28
|
-
"play_button": "Jugar Ahora",
|
29
|
-
"top_ranking": "Los mejores {{number}}",
|
30
|
-
"rewards_one": "Recompensa",
|
31
|
-
"rewards_other": "Recompensas"
|
32
|
-
},
|
33
|
-
|
34
|
-
}
|
35
|
-
},
|
36
|
-
id: {
|
37
|
-
translation: {
|
38
|
-
"dashboard": {
|
39
|
-
"suggested_offers": "Penawaran yang Disarankan",
|
40
|
-
"more_offers": "Penawaran Lainnya",
|
41
|
-
"my_games": "Permainan Saya",
|
42
|
-
"play_button": "Mainkan Sekarang",
|
43
|
-
"top_ranking": "Top {{number}}",
|
44
|
-
"rewards_one": "Hadiah",
|
45
|
-
"rewards_other": "Hadiah"
|
46
|
-
},
|
47
|
-
}
|
48
|
-
},
|
49
|
-
in: {
|
50
|
-
translation: {
|
51
|
-
"dashboard": {
|
52
|
-
"suggested_offers": "Penawaran yang Disarankan",
|
53
|
-
"more_offers": "Penawaran Lainnya",
|
54
|
-
"my_games": "Permainan Saya",
|
55
|
-
"play_button": "Mainkan Sekarang",
|
56
|
-
"top_ranking": "Top {{number}}",
|
57
|
-
"rewards_one": "Hadiah",
|
58
|
-
"rewards_other": "Hadiah"
|
59
|
-
},
|
60
|
-
}
|
61
|
-
},
|
62
|
-
ja: {
|
63
|
-
translation: {
|
64
|
-
"dashboard": {
|
65
|
-
"suggested_offers": "おすすめのオファー",
|
66
|
-
"more_offers": "その他のオファー",
|
67
|
-
"my_games": "マイゲーム",
|
68
|
-
"play_button": "プレイ する",
|
69
|
-
"top_ranking": "トップ {{number}}",
|
70
|
-
"rewards_one": "報酬",
|
71
|
-
"rewards_other": "報酬"
|
72
|
-
},
|
73
|
-
}
|
74
|
-
},
|
75
|
-
ko: {
|
76
|
-
translation: {
|
77
|
-
"dashboard": {
|
78
|
-
"suggested_offers": "추천 제안",
|
79
|
-
"more_offers": "더 많은 제안",
|
80
|
-
"my_games": "내 게임",
|
81
|
-
"play_button": "플레이 하고",
|
82
|
-
"top_ranking": "상위 {{number}}",
|
83
|
-
"rewards_one": "보상",
|
84
|
-
"rewards_other": "보상들"
|
85
|
-
},
|
86
|
-
}
|
87
|
-
}
|
88
|
-
};
|
89
|
-
|
90
|
-
const initializeI18n = async () => {
|
91
|
-
try {
|
92
|
-
const language:any = await AsyncStorage.getItem('language');
|
93
|
-
const storedLanguage: string = JSON.parse(language);
|
94
|
-
console.log('storedLanguage', storedLanguage);
|
95
|
-
|
96
|
-
const initialLanguage = storedLanguage;
|
97
|
-
await i18n
|
98
|
-
.use(initReactI18next)
|
99
|
-
.init({
|
100
|
-
resources,
|
101
|
-
fallbackLng: 'en',
|
102
|
-
lng: initialLanguage,
|
103
|
-
debug: __DEV__,
|
104
|
-
interpolation: {
|
105
|
-
escapeValue: false,
|
106
|
-
},
|
107
|
-
});
|
108
|
-
} catch (error) {
|
109
|
-
console.error('Error initializing i18n:', error);
|
110
|
-
}
|
111
|
-
};
|
112
|
-
|
113
|
-
initializeI18n();
|
114
|
-
|
1
|
+
import i18n from 'i18next';
|
2
|
+
import { initReactI18next } from 'react-i18next';
|
3
|
+
import AsyncStorage from '@react-native-async-storage/async-storage';
|
4
|
+
|
5
|
+
|
6
|
+
const resources = {
|
7
|
+
en: {
|
8
|
+
translation: {
|
9
|
+
"dashboard": {
|
10
|
+
"suggested_offers": "Suggested Offers",
|
11
|
+
"more_offers": "More Offers",
|
12
|
+
"my_games": "My Games",
|
13
|
+
"play_button": "Play Now",
|
14
|
+
"top_ranking": "Top {{number}}",
|
15
|
+
"rewards_one": "Reward",
|
16
|
+
"rewards_other": "Rewards"
|
17
|
+
},
|
18
|
+
|
19
|
+
|
20
|
+
}
|
21
|
+
},
|
22
|
+
es: {
|
23
|
+
translation: {
|
24
|
+
"dashboard": {
|
25
|
+
"suggested_offers": "Ofertas sugeridas",
|
26
|
+
"more_offers": "Más ofertas",
|
27
|
+
"my_games": "Mis juegos",
|
28
|
+
"play_button": "Jugar Ahora",
|
29
|
+
"top_ranking": "Los mejores {{number}}",
|
30
|
+
"rewards_one": "Recompensa",
|
31
|
+
"rewards_other": "Recompensas"
|
32
|
+
},
|
33
|
+
|
34
|
+
}
|
35
|
+
},
|
36
|
+
id: {
|
37
|
+
translation: {
|
38
|
+
"dashboard": {
|
39
|
+
"suggested_offers": "Penawaran yang Disarankan",
|
40
|
+
"more_offers": "Penawaran Lainnya",
|
41
|
+
"my_games": "Permainan Saya",
|
42
|
+
"play_button": "Mainkan Sekarang",
|
43
|
+
"top_ranking": "Top {{number}}",
|
44
|
+
"rewards_one": "Hadiah",
|
45
|
+
"rewards_other": "Hadiah"
|
46
|
+
},
|
47
|
+
}
|
48
|
+
},
|
49
|
+
in: {
|
50
|
+
translation: {
|
51
|
+
"dashboard": {
|
52
|
+
"suggested_offers": "Penawaran yang Disarankan",
|
53
|
+
"more_offers": "Penawaran Lainnya",
|
54
|
+
"my_games": "Permainan Saya",
|
55
|
+
"play_button": "Mainkan Sekarang",
|
56
|
+
"top_ranking": "Top {{number}}",
|
57
|
+
"rewards_one": "Hadiah",
|
58
|
+
"rewards_other": "Hadiah"
|
59
|
+
},
|
60
|
+
}
|
61
|
+
},
|
62
|
+
ja: {
|
63
|
+
translation: {
|
64
|
+
"dashboard": {
|
65
|
+
"suggested_offers": "おすすめのオファー",
|
66
|
+
"more_offers": "その他のオファー",
|
67
|
+
"my_games": "マイゲーム",
|
68
|
+
"play_button": "プレイ する",
|
69
|
+
"top_ranking": "トップ {{number}}",
|
70
|
+
"rewards_one": "報酬",
|
71
|
+
"rewards_other": "報酬"
|
72
|
+
},
|
73
|
+
}
|
74
|
+
},
|
75
|
+
ko: {
|
76
|
+
translation: {
|
77
|
+
"dashboard": {
|
78
|
+
"suggested_offers": "추천 제안",
|
79
|
+
"more_offers": "더 많은 제안",
|
80
|
+
"my_games": "내 게임",
|
81
|
+
"play_button": "플레이 하고",
|
82
|
+
"top_ranking": "상위 {{number}}",
|
83
|
+
"rewards_one": "보상",
|
84
|
+
"rewards_other": "보상들"
|
85
|
+
},
|
86
|
+
}
|
87
|
+
}
|
88
|
+
};
|
89
|
+
|
90
|
+
const initializeI18n = async () => {
|
91
|
+
try {
|
92
|
+
const language:any = await AsyncStorage.getItem('language');
|
93
|
+
const storedLanguage: string = JSON.parse(language);
|
94
|
+
console.log('storedLanguage', storedLanguage);
|
95
|
+
|
96
|
+
const initialLanguage = storedLanguage;
|
97
|
+
await i18n
|
98
|
+
.use(initReactI18next)
|
99
|
+
.init({
|
100
|
+
resources,
|
101
|
+
fallbackLng: 'en',
|
102
|
+
lng: initialLanguage,
|
103
|
+
debug: __DEV__,
|
104
|
+
interpolation: {
|
105
|
+
escapeValue: false,
|
106
|
+
},
|
107
|
+
});
|
108
|
+
} catch (error) {
|
109
|
+
console.error('Error initializing i18n:', error);
|
110
|
+
}
|
111
|
+
};
|
112
|
+
|
113
|
+
initializeI18n();
|
114
|
+
|
115
115
|
export default i18n;
|