TOPIC: LongDateTime in Spanish give strange result
#1665
LongDateTime in Spanish give strange result 8 Months, 3 Weeks ago
Bellow is what suneido trunk is showing for LongDateTime in Spanish on Spain:

Domingo, 29' 29e 'Noviembre' 29e '2009 9:21

Expected

Domingo, 29 de Noviembre de 2009 9:21

It seems that it gets the date format from locale and in Spain it returns something like this:

"dddd de MMMM dd de yyyy"

And the suneido FormatEn translates the first letter of "de" to "29e".

I've tried to set Suneido.LongDateFormat = "dddd \de MMMM dd \de yyyy" but no luck.

Any clue on it ?

Adding this to FormatEn in sudate.cpp

case 'A' :
case 't' :
dst.push_back(dt.hour < 12 ? 'A' : 'P');
if (n > 1)
dst.push_back('M');
break ;
///-----------------------
case '\\' :
f++;
dst.push_back(*f);
break ;
//------------------------
default :
while (--n >= 0)
dst.push_back(*f);

Make it work with : Suneido.LongDateFormat = "dddd \de MMMM dd \de yyyy"
 
 
Last Edit: 2009/11/29 10:50 By mingodad.
 
#1669
Re:LongDateTime in Spanish give strange result 8 Months, 3 Weeks ago
The date translation system is not so good.

Your fix seems reasonable, I will add it.

I wonder how Windows (and other programs) handle that kind of format? Do they only convert "d" if it is a "word" by itself? We could change the code to work that way.
 
 
andrew
 
#1675
Re:LongDateTime in Spanish give strange result 8 Months, 3 Weeks ago
I added your fix. It seems to work fine.

It will be in the next version I post.

Thanks!
 
 
andrew
 
#1744
Re:LongDateTime in Spanish give strange result 8 Months, 2 Weeks ago
Looking at Print(Suneido.LongDateFormat):

dddd, dd' de 'MMMM' de 'yyyy

So it seems that strings specific to locale comes betwen single quotes

I've modified sudate.cpp again and added this:

Code:


case 't' :
dst.push_back(dt.hour < 12 ? 'A' : 'P');
if (n > 1)
dst.push_back('M');
break ;
#define LOCALE_STR_DELIMITER '\''
case LOCALE_STR_DELIMITER : //locale strings come betwen '
            f++;
            while(*f && (*f != LOCALE_STR_DELIMITER))
     dst.push_back(*f++);
break ;
case '\\' :
dst.push_back(*++f);
break ;




And it's working fine now for Spanish locale.
 
 
Last Edit: 2009/12/11 00:01 By mingodad.
 
#1748
Re:LongDateTime in Spanish give strange result 8 Months, 2 Weeks ago
Ok, I will make the change.

Should we keep the backslash change or remove it?
 
 
andrew
 
#1749
Re:LongDateTime in Spanish give strange result 8 Months, 2 Weeks ago
The backslash at first I don't think that will hurt and it is a standard escape sequence, so in my own suneido I preserve it.