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
This commit is contained in:
Chris Young 2009-05-09 18:56:12 +00:00
parent 1612d0f40d
commit c523d9f20b
2 changed files with 74 additions and 12 deletions

View File

@ -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");

View File

@ -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 <Locale language name>:<two character language code>
# Format is <Locale language name>:<language tag>
#
# 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
english:en
german:de
french:fr
albanian:sq
belarusian:be
bosnian:bs
bulgarian:bg
catalan:ca
croatian:hr
czech:cs
danish:da
dutch:nl
english:en
english-british:en-GB
esperanto:eo
estonian:et
faroese:fo
finnish:fi
french:fr
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