DictionaryForMids Forum

DictionaryForMIDs for Android devices => General discussions => Topic started by: jn0101 on 01. June 2010, 13:08:15

Title: Smal bug
Post by: jn0101 on 01. June 2010, 13:08:15
See here

This is for "Esperanto-Czech", 320827 bytes.

I suspect the string
   <string name="file_size">%1$,.2f %2$s</string>
is somehow causing trouble.

I always get it when unit is kilobytes.
I never get it when unit is megabytes.
Title: Re: Smal bug
Post by: axin on 01. June 2010, 15:59:55
Thanks for the report!

This is an Android 1.6 device with en-US locale using DfM with Esperanto UI, yes?
Does Esperanto use , or . as decimal separator, e.g. 5,31 or 5.31? I guess the bug is not related to KB, MB,... but to the number of digits before the decimal separator. If Esperanto uses . for separation, we just delete the , in file_size. If not... hmm...

-Achim
Title: Re: Smal bug
Post by: jn0101 on 01. June 2010, 21:50:49
Esperanto and Danish uses (like most european countries) the , to seperate the fraction from the whole part.
What shoud the pattern be, in this case?

Probably a lot of translators will have missed this...
Title: Re: Smal bug
Post by: axin on 04. June 2010, 10:33:59
Some more investigations into that problem:

The docs changed as the Android SDK developed:
- http://www.androidside.com/docs/docs1.5/reference/java/util/Formatter.html (http://www.androidside.com/docs/docs1.5/reference/java/util/Formatter.html): flag , stands for "Use a comma in place of a decimal if the locale requires it."
- http://developer.android.com/reference/java/util/Formatter.html (http://developer.android.com/reference/java/util/Formatter.html): does not mention this anymore

Some tests on Emulator with en-US system default locale:
- Android 1.5, da UI locale: "%1$.2f" gives 123.45, "%1$,.2f" gives 1,2,3.45
- Android 1.6, da UI locale: "%1$.2f" gives 123,45, "%1$,.2f" gives 123,45
- Android 1.6, eo UI locale: "%1$.2f" gives 123.45, "%1$,.2f" gives 1,2,3.45
- Android 2.0, eo UI locale: "%1$.2f" gives 123.45, "%1$,.2f" gives 1,2,3.45

It looks like the behaviour is always wrong when there is a comma (I guess this has once been working with some older version of the SDK), so as an intermediate solution I'll remove the comma from file_size for all languages. Danish and other European versions will then use the comma instead of the point, but unsupported locales like Esperanto will fall back to some default locale for formatting numbers (en-US on my system), consequently those locales will be using the point as decimal separator.
This way is definitely not perfect, but better than before, yes?

What struck me most was that no one else experienced this problem. Normally I'd expect many forum posts describing the problem...

-Achim
Title: Re: Smal bug
Post by: jn0101 on 04. June 2010, 15:46:12
Cool you found out Achim!

Yes, seems a good idea.

In general I think you can assume that noone are using 1.5 anymore (but 1.6 yes).

Jacob
Title: Re: Smal bug
Post by: axin on 12. June 2010, 11:50:49
test release: Android Test Release 0.12.1_TEST2 (http://dictionarymid.sourceforge.net/forum/index.php?topic=243.msg1288#msg1288)