From c523d9f20b57ceb4d015be87a7bef8841dbc5e2b Mon Sep 17 00:00:00 2001 From: Chris Young Date: Sat, 9 May 2009 18:56:12 +0000 Subject: Populate option_accept_language with the user's preferred languages, in order. LangNames now contains the language codes for all languages available with OS4.1, plus Welsh (http://aminet.net/package/misc/misc/welsh_lang). There are no other 3rd party .language files available for OS4 that I am aware of, but any new ones can easily be added if/when they become available. These may now not be exactly the same as the RISC OS names, but that can be resolved by renaming directories for new translations (current ones are OK), or reverting back to the AmigaOS names for Messages files paths. svn path=/trunk/netsurf/; revision=7452 --- amiga/gui.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'amiga/gui.c') diff --git a/amiga/gui.c b/amiga/gui.c index 13f14837d..402345151 100755 --- a/amiga/gui.c +++ b/amiga/gui.c @@ -181,7 +181,7 @@ static void *myrealloc(void *ptr, size_t len, void *pw); void gui_init(int argc, char** argv) { struct Locale *locale; - char lang[100],throbberfile[100]; + char lang[100],throbberfile[100],tempacceptlangs[100] = "\0"; bool found=FALSE; int i; BPTR lock=0,amiupdatefh; @@ -271,6 +271,25 @@ 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); @@ -288,6 +307,9 @@ void gui_init(int argc, char** argv) css_scrollbar_bg_colour = 0x00833c3c; css_scrollbar_arrow_colour = 0x00d6d6d6; + if((!option_accept_language) || (option_accept_language[0] == '\0')) + option_accept_language = (char *)strdup(tempacceptlangs); + if((!option_cookie_file) || (option_cookie_file[0] == '\0')) option_cookie_file = (char *)strdup("PROGDIR:Resources/Cookies"); -- cgit v1.2.3