Commit 854c2e46 authored by Claes Sjofors's avatar Claes Sjofors

Lng, return status from get()

parent 74208f57
......@@ -562,24 +562,26 @@ void Lng::get_uid( char *in, char *out)
strcpy( out, result);
}
void Lng::set( char *language)
pwr_tStatus Lng::set( char *language)
{
pwr_tStatus sts;
lng_eLanguage l = str_to_lang( language);
if ( l != lng_eLanguage_) {
sts = set( l);
if ( EVEN(sts)) return;
if ( EVEN(sts)) return sts;
}
setlocale( LC_ALL, lang_to_locale( l));
setlocale( LC_NUMERIC, "POSIX");
setlocale( LC_TIME, "en_US");
return 1;
}
pwr_tStatus Lng::set( lng_eLanguage language)
{
if ( lang == language)
return 1;
return LNG__ALREADYSET;
if ( language == lng_eLanguage_en_US) {
lang = language;
......
......@@ -286,7 +286,7 @@ class Lng {
static void unload();
static pwr_tStatus set( lng_eLanguage language);
static lng_eLanguage current() { return lang;}
static void set( char *language);
static pwr_tStatus set( char *language);
static char *get( int item)
{ return items[lang][item];}
static char *get( lng_eLanguage language, int item)
......
......@@ -44,5 +44,6 @@ eof <End of file> /error
diffcoding <Coding of global and local translationfiles differ> /error
file <Unable to open file> /error
includemismatch <Include statement mismatch> /error
alreadyset <Specified language already set> /error
.end
......@@ -1044,6 +1044,7 @@ static int xnav_set_func( void *client_data,
{
char language_str[80];
ApplListElem *elem;
pwr_tStatus sts;
// Command is "SET LANGUAGE"
if ( EVEN( dcli_get_qualifier( "dcli_arg2", language_str, sizeof(language_str)))) {
......@@ -1051,8 +1052,12 @@ static int xnav_set_func( void *client_data,
return XNAV__HOLDCOMMAND;
}
cdh_ToLower( language_str, language_str);
Lng::set( language_str);
sts = Lng::set( language_str);
if ( EVEN(sts)) {
xnav->message(' ', XNav::get_message(sts));
return XNAV__SUCCESS;
}
// Set new coding to all graphs
for ( elem = xnav->appl.root; elem; elem = elem->next) {
if ( elem->type == applist_eType_Graph)
......
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