Commit c809273f authored by claes's avatar claes

locale set when language is set

parent 8a36f763
/**
* Proview $Id: co_lng.cpp,v 1.11 2005-12-21 08:30:59 claes Exp $
* Proview $Id: co_lng.cpp,v 1.12 2007-04-17 13:55:58 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -20,6 +20,7 @@
#include <string.h>
#include <stdio.h>
#include <locale.h>
#include "pwr.h"
......@@ -65,6 +66,23 @@ char *Lng::lang_to_str( lng_eLanguage language)
return result;
}
char *Lng::lang_to_locale( lng_eLanguage language)
{
static char result[20];
switch( language) {
case lng_eLanguage_sv_se:
strcpy( result, "sv_SE");
break;
case lng_eLanguage_de_de:
strcpy( result, "de_DE");
break;
default:
strcpy( result, "en_US");
}
return result;
}
static int compKey( tree_sTable *tp, tree_sNode *x, tree_sNode *y)
{
lang_sKey *xKey = (lang_sKey *) (tp->keyOffset + (char *) x);
......@@ -331,6 +349,8 @@ void Lng::set( char *language)
lng_eLanguage l = str_to_lang( language);
if ( l != lng_eLanguage_)
set( l);
setlocale( LC_ALL, lang_to_locale( l));
}
void Lng::set( lng_eLanguage language)
......@@ -343,6 +363,8 @@ void Lng::set( lng_eLanguage language)
unload();
else
read();
setlocale( LC_ALL, lang_to_locale( lang));
}
......
/**
* Proview $Id: co_lng.h,v 1.6 2005-09-26 08:03:02 claes Exp $
* Proview $Id: co_lng.h,v 1.7 2007-04-17 13:55:58 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -135,6 +135,7 @@ class Lng {
static void get_uid( char *in, char *out);
static lng_eLanguage str_to_lang( char *str);
static char *lang_to_str( lng_eLanguage language);
static char *lang_to_locale( lng_eLanguage language);
};
#if defined __cplusplus
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment