[sword-svn] r1744 - trunk/src/mgr
dglassey at crosswire.org
dglassey at crosswire.org
Sat Mar 19 07:06:11 MST 2005
Author: dglassey
Date: 2005-03-19 07:06:11 -0700 (Sat, 19 Mar 2005)
New Revision: 1744
Modified:
trunk/src/mgr/localemgr.cpp
Log:
default locale to lang if lang_country doesn't exist in setDefaultLocale
Modified: trunk/src/mgr/localemgr.cpp
===================================================================
--- trunk/src/mgr/localemgr.cpp 2005-03-19 00:55:26 UTC (rev 1743)
+++ trunk/src/mgr/localemgr.cpp 2005-03-19 14:06:11 UTC (rev 1744)
@@ -238,7 +238,21 @@
char *tmplang=0;
stdstr(&tmplang, name);
strtok(tmplang, ".");
- stdstr(&defaultLocaleName, tmplang);
+ // Before we set it we want to verify that it is an existing locale
+ // First check for what we ask for
+ if (getLocale(tmplang)) {
+ stdstr(&defaultLocaleName, tmplang);
+ }
+ else {
+ // check for locale without country
+ char *nocntry=0;
+ stdstr(&nocntry, tmplang);
+ strtok(nocntry, "_");
+ if (getLocale(nocntry)) {
+ stdstr(&defaultLocaleName, nocntry);
+ }
+ delete [] nocntry;
+ }
delete [] tmplang;
}
More information about the sword-cvs
mailing list