revert between 56095 -> 55830 in arch
[AROS.git] / workbench / libs / lowlevel / getlanguageselection.c
blobf51220f024642f15043f37981c750cffaba2e002
1 /*
2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc:
6 Lang: english
7 */
9 #include <string.h>
10 #include <aros/libcall.h>
11 #include <exec/types.h>
12 #include <libraries/lowlevel.h>
13 #include <libraries/locale.h>
14 #include <proto/locale.h>
16 #include "lowlevel_intern.h"
18 static struct
20 char * langstring;
21 ULONG lang;
22 } langlist [] =
24 { "english.language" , LANG_ENGLISH },
25 { "deutsch.language" , LANG_GERMAN },
26 { "français.language" , LANG_FRENCH },
27 { "español.language" , LANG_SPANISH },
28 { "italiano.language" , LANG_ITALIAN },
29 { "português.language" , LANG_PORTUGUESE },
30 { "dansk.language" , LANG_DANISH },
31 { "nederlands.language" , LANG_DUTCH },
32 { "norsk.language" , LANG_NORWEGIAN },
33 { "suomi.language" , LANG_FINNISH },
34 { "svenska.language" , LANG_SWEDISH },
35 { "greek.language" , LANG_GREEK }
38 /*****************************************************************************
40 NAME */
42 AROS_LH0(ULONG, GetLanguageSelection,
44 /* SYNOPSIS */
46 /* LOCATION */
47 struct LowLevelBase *, LowLevelBase, 6, LowLevel)
49 /* FUNCTION
51 INPUTS
53 RESULT
55 BUGS
57 INTERNALS
59 *****************************************************************************/
61 AROS_LIBFUNC_INIT
63 int index = 0;
64 APTR LocaleBase;
67 * Get the default locale
69 struct Locale * locale;
71 LocaleBase = OpenLibrary("locale.library", 0);
72 if (LocaleBase == NULL)
73 return LANG_UNKNOWN;
75 locale = OpenLocale("");
77 if (NULL == locale) {
78 CloseLibrary(LocaleBase);
79 return LANG_UNKNOWN;
82 while (NULL != langlist[index].langstring)
84 if (0 == strcmp(locale->loc_LanguageName, langlist[index].langstring))
86 CloseLocale(locale);
87 CloseLibrary(LocaleBase);
88 return langlist[index].lang;
90 index++;
93 CloseLocale(locale);
94 CloseLibrary(LocaleBase);
95 return LANG_UNKNOWN;
97 AROS_LIBFUNC_EXIT
98 } /* GetLanguageSelection */