Mercurial > pidgin
comparison src/win_gaim.c @ 10330:4f5a7ddd3161
[gaim-migrate @ 11537]
Get rid of 3 goto's. Can someone please let me know if this doesn't
compile?
Herman, I hope this changes are ok with you... if not, feel free
to revert it.
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Thu, 09 Dec 2004 00:24:30 +0000 |
parents | 53c9ba039354 |
children | db44efdf6565 |
comparison
equal
deleted
inserted
replaced
10329:0ad82da3ffcf | 10330:4f5a7ddd3161 |
---|---|
214 /* Determine and set Gaim locale as follows (in order of priority): | 214 /* Determine and set Gaim locale as follows (in order of priority): |
215 - Check GAIMLANG env var | 215 - Check GAIMLANG env var |
216 - Check NSIS Installer Language reg value | 216 - Check NSIS Installer Language reg value |
217 - Use default user locale | 217 - Use default user locale |
218 */ | 218 */ |
219 static void wgaim_set_locale() { | 219 static const char* wgaim_get_locale() { |
220 const char* locale=NULL; | |
220 char data[10]; | 221 char data[10]; |
221 DWORD datalen = 10; | 222 DWORD datalen = 10; |
222 char* locale=NULL; | |
223 char envstr[25]; | |
224 LCID lcid; | 223 LCID lcid; |
225 | 224 |
226 /* Check if user set GAIMLANG env var */ | 225 /* Check if user set GAIMLANG env var */ |
227 if((locale = (char*)getenv("GAIMLANG"))) | 226 if((locale = getenv("GAIMLANG"))) |
228 goto finish; | 227 return locale; |
229 | 228 |
230 if(read_reg_string(HKEY_CURRENT_USER, "SOFTWARE\\gaim", "Installer Language", (LPBYTE)&data, &datalen)) { | 229 if(read_reg_string(HKEY_CURRENT_USER, "SOFTWARE\\gaim", "Installer Language", (LPBYTE)&data, &datalen)) { |
231 if((locale = wgaim_lcid_to_posix(atoi(data)))) | 230 if((locale = wgaim_lcid_to_posix(atoi(data)))) |
232 goto finish; | 231 return locale; |
233 } | 232 } |
234 | 233 |
235 lcid = GetUserDefaultLCID(); | 234 lcid = GetUserDefaultLCID(); |
236 if((locale = wgaim_lcid_to_posix(lcid))) | 235 if((locale = wgaim_lcid_to_posix(lcid))) |
237 goto finish; | 236 return locale; |
238 | 237 |
239 finish: | 238 return "en"; |
240 if(!locale) | 239 } |
241 locale = "en"; | 240 |
241 static void wgaim_set_locale() { | |
242 const char* locale=NULL; | |
243 char envstr[25]; | |
244 | |
245 locale = wgaim_get_locale(); | |
242 | 246 |
243 snprintf(envstr, 25, "LANG=%s", locale); | 247 snprintf(envstr, 25, "LANG=%s", locale); |
244 printf("Setting locale: %s\n", envstr); | 248 printf("Setting locale: %s\n", envstr); |
245 putenv(envstr); | 249 putenv(envstr); |
246 } | 250 } |