@@ -66,98 +66,68 @@ public static void setLanguage(Context context) {
66
66
R .array .app_language ), (dialogInterface , i ) -> {
67
67
switch (i ) {
68
68
case 0 :
69
- if (!Utils .languageDefault (context )) {
70
- Utils .saveBoolean ("use_en" , false , context );
71
- Utils .saveBoolean ("use_ko" , false , context );
72
- Utils .saveBoolean ("use_in" , false , context );
73
- Utils .saveBoolean ("use_am" , false , context );
74
- Utils .saveBoolean ("use_el" , false , context );
75
- Utils .saveBoolean ("use_pt" , false , context );
76
- Utils .saveBoolean ("use_ru" , false , context );
69
+ if (!Utils .getLanguage (context ).equals (java .util .Locale .getDefault ().getLanguage ())) {
70
+ Utils .saveString ("appLanguage" , java .util .Locale .getDefault ().getLanguage (), context );
77
71
Utils .restartApp (context );
78
72
}
79
73
break ;
80
74
case 1 :
81
- if (!Utils .getBoolean ("use_en" , false , context )) {
82
- Utils .saveBoolean ("use_en" , true , context );
83
- Utils .saveBoolean ("use_ko" , false , context );
84
- Utils .saveBoolean ("use_in" , false , context );
85
- Utils .saveBoolean ("use_am" , false , context );
86
- Utils .saveBoolean ("use_el" , false , context );
87
- Utils .saveBoolean ("use_pt" , false , context );
88
- Utils .saveBoolean ("use_ru" , false , context );
75
+ if (!Utils .getLanguage (context ).equals ("en_US" )) {
76
+ Utils .saveString ("appLanguage" , "en_US" , context );
89
77
Utils .restartApp (context );
90
78
}
91
79
break ;
92
80
case 2 :
93
- if (!Utils .getBoolean ("use_ko" , false , context )) {
94
- Utils .saveBoolean ("use_en" , false , context );
95
- Utils .saveBoolean ("use_ko" , true , context );
96
- Utils .saveBoolean ("use_in" , false , context );
97
- Utils .saveBoolean ("use_am" , false , context );
98
- Utils .saveBoolean ("use_el" , false , context );
99
- Utils .saveBoolean ("use_pt" , false , context );
100
- Utils .saveBoolean ("use_ru" , false , context );
81
+ if (!Utils .getLanguage (context ).equals ("ko" )) {
82
+ Utils .saveString ("appLanguage" , "ko" , context );
101
83
Utils .restartApp (context );
102
84
}
103
85
break ;
104
86
case 3 :
105
- if (!Utils .getBoolean ("use_am" , false , context )) {
106
- Utils .saveBoolean ("use_en" , false , context );
107
- Utils .saveBoolean ("use_ko" , false , context );
108
- Utils .saveBoolean ("use_in" , false , context );
109
- Utils .saveBoolean ("use_am" , true , context );
110
- Utils .saveBoolean ("use_el" , false , context );
111
- Utils .saveBoolean ("use_pt" , false , context );
112
- Utils .saveBoolean ("use_ru" , false , context );
87
+ if (!Utils .getLanguage (context ).equals ("am" )) {
88
+ Utils .saveString ("appLanguage" , "am" , context );
113
89
Utils .restartApp (context );
114
90
}
115
91
break ;
116
92
case 4 :
117
- if (!Utils .getBoolean ("use_el" , false , context )) {
118
- Utils .saveBoolean ("use_en" , false , context );
119
- Utils .saveBoolean ("use_ko" , false , context );
120
- Utils .saveBoolean ("use_in" , false , context );
121
- Utils .saveBoolean ("use_am" , false , context );
122
- Utils .saveBoolean ("use_el" , true , context );
123
- Utils .saveBoolean ("use_pt" , false , context );
124
- Utils .saveBoolean ("use_ru" , false , context );
93
+ if (!Utils .getLanguage (context ).equals ("el" )) {
94
+ Utils .saveString ("appLanguage" , "el" , context );
125
95
Utils .restartApp (context );
126
96
}
127
97
break ;
128
98
case 5 :
129
- if (!Utils .getBoolean ("use_in" , false , context )) {
130
- Utils .saveBoolean ("use_en" , false , context );
131
- Utils .saveBoolean ("use_ko" , false , context );
132
- Utils .saveBoolean ("use_in" , true , context );
133
- Utils .saveBoolean ("use_am" , false , context );
134
- Utils .saveBoolean ("use_el" , false , context );
135
- Utils .saveBoolean ("use_pt" , false , context );
136
- Utils .saveBoolean ("use_ru" , false , context );
99
+ if (!Utils .getLanguage (context ).equals ("in" )) {
100
+ Utils .saveString ("appLanguage" , "in" , context );
137
101
Utils .restartApp (context );
138
102
}
139
103
break ;
140
104
case 6 :
141
- if (!Utils .getBoolean ("use_pt" , false , context )) {
142
- Utils .saveBoolean ("use_en" , false , context );
143
- Utils .saveBoolean ("use_ko" , false , context );
144
- Utils .saveBoolean ("use_in" , false , context );
145
- Utils .saveBoolean ("use_am" , false , context );
146
- Utils .saveBoolean ("use_el" , false , context );
147
- Utils .saveBoolean ("use_pt" , true , context );
148
- Utils .saveBoolean ("use_ru" , false , context );
105
+ if (!Utils .getLanguage (context ).equals ("pt" )) {
106
+ Utils .saveString ("appLanguage" , "pt" , context );
149
107
Utils .restartApp (context );
150
108
}
151
109
break ;
152
110
case 7 :
153
- if (!Utils .getBoolean ("use_ru" , false , context )) {
154
- Utils .saveBoolean ("use_en" , false , context );
155
- Utils .saveBoolean ("use_ko" , false , context );
156
- Utils .saveBoolean ("use_in" , false , context );
157
- Utils .saveBoolean ("use_am" , false , context );
158
- Utils .saveBoolean ("use_el" , false , context );
159
- Utils .saveBoolean ("use_pt" , false , context );
160
- Utils .saveBoolean ("use_ru" , true , context );
111
+ if (!Utils .getLanguage (context ).equals ("ru" )) {
112
+ Utils .saveString ("appLanguage" , "ru" , context );
113
+ Utils .restartApp (context );
114
+ }
115
+ break ;
116
+ case 8 :
117
+ if (!Utils .getLanguage (context ).equals ("pl" )) {
118
+ Utils .saveString ("appLanguage" , "pl" , context );
119
+ Utils .restartApp (context );
120
+ }
121
+ break ;
122
+ case 9 :
123
+ if (!Utils .getLanguage (context ).equals ("zh" )) {
124
+ Utils .saveString ("appLanguage" , "zh" , context );
125
+ Utils .restartApp (context );
126
+ }
127
+ break ;
128
+ case 10 :
129
+ if (!Utils .getLanguage (context ).equals ("uk" )) {
130
+ Utils .saveString ("appLanguage" , "uk" , context );
161
131
Utils .restartApp (context );
162
132
}
163
133
break ;
@@ -167,22 +137,29 @@ public static void setLanguage(Context context) {
167
137
}
168
138
169
139
public static String getLanguage (Context context ) {
170
- if (Utils .getBoolean ("use_english" , false , context )) {
171
- return context .getString (R .string .language_en );
172
- } else if (Utils .getBoolean ("use_korean" , false , context )) {
173
- return context .getString (R .string .language_ko );
174
- } else if (Utils .getBoolean ("use_am" , false , context )) {
175
- return context .getString (R .string .language_am );
176
- } else if (Utils .getBoolean ("use_el" , false , context )) {
177
- return context .getString (R .string .language_el );
178
- }else if (Utils .getBoolean ("use_in" , false , context )) {
179
- return context .getString (R .string .language_in );
180
- } else if (Utils .getBoolean ("use_pt" , false , context )) {
181
- return context .getString (R .string .language_pt );
182
- } else if (Utils .getBoolean ("use_ru" , false , context )) {
183
- return context .getString (R .string .language_ru );
184
- } else {
185
- return context .getString (R .string .language_default );
140
+ switch (Utils .getLanguage (context )) {
141
+ case "en_US" :
142
+ return context .getString (R .string .language_en );
143
+ case "ko" :
144
+ return context .getString (R .string .language_ko );
145
+ case "am" :
146
+ return context .getString (R .string .language_am );
147
+ case "el" :
148
+ return context .getString (R .string .language_el );
149
+ case "pt" :
150
+ return context .getString (R .string .language_pt );
151
+ case "ru" :
152
+ return context .getString (R .string .language_ru );
153
+ case "in" :
154
+ return context .getString (R .string .language_in );
155
+ case "uk" :
156
+ return context .getString (R .string .language_uk );
157
+ case "zh" :
158
+ return context .getString (R .string .language_zh );
159
+ case "pl" :
160
+ return context .getString (R .string .language_pl );
161
+ default :
162
+ return context .getString (R .string .language_default ) + " (" + java .util .Locale .getDefault ().getLanguage () + ")" ;
186
163
}
187
164
}
188
165
0 commit comments