Home » U++ Library support » U++ Core » i18n
i18n [message #9707] |
Fri, 25 May 2007 23:15 |
|
2 things i found on Linux Gentoo & FreeBSD
i have at the begining of App
SetLanguage(GetSystemLNG());
If i dont have locale on OS set with above invocation of Setlanguage the Format(..) function throws Assert
if I disable above SetLanguage, the Format for such string writes no . or , chars for double value.
Format( value < 0 ? "(%nl)" : "%nl", value);
[Updated on: Fri, 25 May 2007 23:16] Report message to a moderator
|
|
|
|
Re: i18n [message #9711 is a reply to message #9709] |
Sat, 26 May 2007 18:01 |
|
This will fix the app crash , ie read beoyond the string
But I'm not sure where to search fo lack of "." or "," in double values
#ifdef PLATFORM_POSIX
int GetSystemLNG() {
static int lang;
INIT_LOCK (
String s = Environment().Get("LANG", Null);
if ( s.GetCount()>4 )
lang = LNGFromText(s);
else
lang = LNG_ENGLISH;
const char *q = strchr(s, '.');
if(q)
lang = SetLNGCharset(lang, CharsetByName(q + 1));
);
return lang;
};
#endif
|
|
|
|
Re: i18n [message #9750 is a reply to message #9725] |
Tue, 29 May 2007 17:36 |
|
lang = LNGFromText(s);
if(!lang)
I got app crashed becouse of attempt to read beoyound the string in
LNGFromText(s);
i have s.GetCount() == 0;
so
int LNGFromText(const char *s)
{
int l = 0;
if(IsAlpha(*s)) {
s == NULL , and will fail , Am i right ?
|
|
|
|
|
Re: i18n [message #9758 is a reply to message #9707] |
Tue, 29 May 2007 18:52 |
|
ONCELOCK undefined ...
----- UppCalc ( GUI MAIN GCC DEBUG SHARED DEBUG_FULL BLITZ LINUX ) (9 / 9)
/root/uppsrc/Core/Lang.cpp: In function 'int Upp::GetSystemLNG()':
/root/uppsrc/Core/Lang.cpp:115: error: expected primary-expression before 's'
/root/uppsrc/Core/Lang.cpp:115: error: expected `)' before 's'
/root/uppsrc/Core/Lang.cpp:116: error: 's' was not declared in this scope
/root/uppsrc/Core/Lang.cpp:122: error: expected primary-expression before ')' token
/root/uppsrc/Core/Lang.cpp:122: error: expected `;' before ')' token
Core: 1 file(s) built in (0:04.03), 4038 msecs / file, duration = 4202 msecs, parallelization 0%
There were errors. (0:06.45)
but with INIT_LOCK works
Hoever there are still no . or , in values from double in formated string.
|
|
|
|
Goto Forum:
Current Time: Thu Apr 25 01:22:43 CEST 2024
Total time taken to generate the page: 0.02790 seconds
|