/*
- * $Id
+ * $Id$
*/
-/**
- * \defgroup LocaleHeaderParser Parse the browser http locale headers and set the NLS stuff.
- * \ingroup WebcitHttpServer
- */
-/*@{*/
+
#include "webcit.h"
#include "webserver.h"
#ifdef ENABLE_NLS
-#define NUM_LANGS 10 /**< how many different locales do we know? */
-#define SEARCH_LANG 20 /**< how many langs should we parse? */
+#define NUM_LANGS 10 /* how many different locales do we know? */
+#define SEARCH_LANG 20 /* how many langs should we parse? */
-/** actual supported locales */
+/* actual supported locales */
char *AvailLang[NUM_LANGS] = {
"C",
"en_US",
* \brief Set the selected language for this session.
* \param lang the locale to set.
*/
-void set_selected_language(char *lang) {
+void set_selected_language(const char *lang) {
int i;
+
#ifdef HAVE_USELOCALE
for (i=0; i<NUM_LANGS; ++i) {
if (!strcasecmp(lang, AvailLang[i])) {
#endif
#endif
}
+
+#ifdef HAVE_USELOCALE
+ locale_t Empty_Locale;
+#endif
+
/**
* \brief Create a locale_t for each available language
*/
char buf[32];
#ifdef HAVE_USELOCALE
- locale_t Empty_Locale;
-
/* create default locale */
Empty_Locale = newlocale(LC_ALL_MASK, NULL, NULL);
#endif
}
}
+void ShutdownLocale(void)
+{
+ int i;
+#ifdef HAVE_USELOCALE
+ for (i = 0; i < NUM_LANGS; ++i) {
+ if (Empty_Locale != wc_locales[i])
+ freelocale(wc_locales[i]);
+ }
+ freelocale(Empty_Locale);
+#endif
+}
#else /* ENABLE_NLS */
/** \brief dummy for non NLS enabled systems */
#endif /* ENABLE_NLS */
-/*@}*/