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 ++++++++++++++++++- amiga/resources/LangNames | 60 +++++++++++++++++++++++++++++++++++++++-------- 2 files changed, 73 insertions(+), 11 deletions(-) (limited to 'amiga') 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"); diff --git a/amiga/resources/LangNames b/amiga/resources/LangNames index 10c3a55f2..51c00e74e 100755 --- a/amiga/resources/LangNames +++ b/amiga/resources/LangNames @@ -1,19 +1,59 @@ # LangNames file for NetSurf AmigaOS # # Maps AmigaOS locale.library language names to the two character -# RISC OS equivalents, enabling localised text strings files -# shareable with the RISC OS version of NetSurf, without the -# hassle of renaming directories. +# ISO-639 codes, enabling localised text strings files shareable +# with the RISC OS version of NetSurf, without the hassle of +# renaming directories, and to specify accept-language encoding +# with no additional configuration. # -# Format is : +# Format is : # -# Netsurf will use the full AmigaOS language name if it is not -# present in this file. If you add a translation please use the -# RISC OS naming scheme when possible and add it to this file! +# NetSurf will use the full AmigaOS language name if it is not +# present in this file. # -english-british:en +albanian:sq +belarusian:be +bosnian:bs +bulgarian:bg +catalan:ca +croatian:hr +czech:cs +danish:da +dutch:nl english:en -german:de +english-british:en-GB +esperanto:eo +estonian:et +faroese:fo +finnish:fi french:fr -dutch:nl +galician:gl +german:de +greek:el +hebrew:he +hungarian:hu +icelandic:is +irish:ga italian:it +latvian:lv +lithuanian:lt +macedonian:mk +malay-indonesian:id +malay-malaysian:ms +maltese:mt +norwegian:nb +norwegian-nynorsk:nn +polish:pl +portuguese:pt +portuguese-brazil:pr-BR +romanian:ro +russian:ru +serbian:sr +slovak:sk +slovenian:sl +spanish:es +swedish:sv +thai:th +turkish:tr +ukrainian:uk +welsh:cy -- cgit v1.2.3