@@ -66,98 +66,68 @@ public static void setLanguage(Context context) {
6666                R .array .app_language ), (dialogInterface , i ) -> {
6767            switch  (i ) {
6868                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 );
7771                        Utils .restartApp (context );
7872                    }
7973                    break ;
8074                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 );
8977                        Utils .restartApp (context );
9078                    }
9179                    break ;
9280                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 );
10183                        Utils .restartApp (context );
10284                    }
10385                    break ;
10486                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 );
11389                        Utils .restartApp (context );
11490                    }
11591                    break ;
11692                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 );
12595                        Utils .restartApp (context );
12696                    }
12797                    break ;
12898                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 );
137101                        Utils .restartApp (context );
138102                    }
139103                    break ;
140104                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 );
149107                        Utils .restartApp (context );
150108                    }
151109                    break ;
152110                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 );
161131                        Utils .restartApp (context );
162132                    }
163133                    break ;
@@ -167,22 +137,29 @@ public static void setLanguage(Context context) {
167137    }
168138
169139    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 () + ")" ;
186163        }
187164    }
188165
0 commit comments