summaryrefslogtreecommitdiff
path: root/amiga/gui.c
diff options
context:
space:
mode:
Diffstat (limited to 'amiga/gui.c')
-rwxr-xr-xamiga/gui.c67
1 files changed, 46 insertions, 21 deletions
diff --git a/amiga/gui.c b/amiga/gui.c
index a36f04541..e52fd721a 100755
--- a/amiga/gui.c
+++ b/amiga/gui.c
@@ -181,10 +181,48 @@ void ami_switch_tab(struct gui_window_2 *gwin,bool redraw);
static void *myrealloc(void *ptr, size_t len, void *pw);
void ami_init_layers(struct RastPort *rp);
+STRPTR ami_locale_langs(void)
+{
+ struct Locale *locale;
+ STRPTR acceptlangs = NULL, acceptlangs2 = NULL;
+ int i;
+
+ if(locale = OpenLocale(NULL))
+ {
+ for(i=0;i<10;i++)
+ {
+ if(locale->loc_PrefLanguages[i])
+ {
+ if(messages_get(locale->loc_PrefLanguages[i]) != locale->loc_PrefLanguages[i])
+ {
+ if(acceptlangs)
+ {
+ acceptlangs2 = acceptlangs;
+ acceptlangs = ASPrintf("%s, %s",acceptlangs2,messages_get(locale->loc_PrefLanguages[i]));
+ FreeVec(acceptlangs2);
+ acceptlangs2 = NULL;
+ }
+ else
+ {
+ acceptlangs = ASPrintf("%s",messages_get(locale->loc_PrefLanguages[i]));
+ }
+ }
+ }
+ else
+ {
+ continue;
+ }
+ }
+ CloseLocale(locale);
+ }
+ return acceptlangs;
+}
+
void gui_init(int argc, char** argv)
{
struct Locale *locale;
- char lang[100],throbberfile[100],tempacceptlangs[100] = "\0";
+ char lang[100],throbberfile[100];
+ STRPTR tempacceptlangs;
bool found=FALSE;
int i;
BPTR lock=0,amiupdatefh;
@@ -274,25 +312,6 @@ void gui_init(int argc, char** argv)
strcpy(lang,"PROGDIR:Resources/en/Messages");
}
- for(i=0;i<10;i++)
- {
- if(locale->loc_PrefLanguages[i])
- {
- if(messages_get(locale->loc_PrefLanguages[i]) != locale->loc_PrefLanguages[i])
- {
- if(tempacceptlangs[0] != '\0')
- {
- strcat(tempacceptlangs,", ");
- }
- strcat(tempacceptlangs,messages_get(locale->loc_PrefLanguages[i]));
- }
- }
- else
- {
- continue;
- }
- }
-
CloseLocale(locale);
messages_load(lang);
@@ -311,7 +330,13 @@ void gui_init(int argc, char** argv)
css_scrollbar_arrow_colour = 0x00d6d6d6;
if((!option_accept_language) || (option_accept_language[0] == '\0'))
- option_accept_language = (char *)strdup(tempacceptlangs);
+ {
+ if(tempacceptlangs = ami_locale_langs())
+ {
+ option_accept_language = (char *)strdup(tempacceptlangs);
+ FreeVec(tempacceptlangs);
+ }
+ }
if((!option_cookie_file) || (option_cookie_file[0] == '\0'))
option_cookie_file = (char *)strdup("PROGDIR:Resources/Cookies");