Bug#608723: [DebianGIS-dev] Bug#608723: josm: LC_CTYPE decides language used for user interface
Hi Torsten. On 03/01/2011 10:23, Torsten Werner wrote: On Mon, Jan 3, 2011 at 9:53 AM, David Paleino d.pale...@gmail.com wrote: I found that this really is a Java bug. no, not really. The page at http://java.sun.com/developer/technicalArticles/J2SE/locale/ explains: Depending on the default locale is not wise. In multiuser applications, a single default locale is usually not appropriate for everyone using the system. Instead your application should explicitly provide a preference to all locale-sensitive objects. While this may be true or not (the mechanism of having proper environment variables set is just made to have different users running the same programs with different locales), I don't think the problem is here. The real issue is that the Locale class seems to be unable to correctly detect the default locale. Of course, given that the Java locale infrastructure isn't able to discriminate between different scopes of a locale (that is, there is nothing like the different LC_* variables), I'm not expecting it to actually display messages in a language and sorting strings or showing numbers according to a different locale. But the algorithm to detect the current default locale seems to be a little strange (I'm using the small program written by David): [12:12] giova...@edelstein:/tmp$ export | grep LC [12:12] giova...@edelstein:/tmp$ export | grep LANG declare -x GDM_LANG=it_IT.utf8 declare -x LANG=it_IT.utf8 [12:12] giova...@edelstein:/tmp$ java LocaleTest Language, Country, Variant, Name Default locale: it, IT, , , italiano (Italia) [12:13] giova...@edelstein:/tmp$ LC_CTYPE=de_DE.UTF-8 java LocaleTest Language, Country, Variant, Name Default locale: de, DE, , , Deutsch (Deutschland) [12:13] giova...@edelstein:/tmp$ LC_MESSAGES=de_DE.UTF-8 java LocaleTest Language, Country, Variant, Name Default locale: it, IT, , , italiano (Italia) Why does LC_TYPE have influence over the the default locale and LC_MESSAGES (or any other LC_* variable) not? Anyway, this seems to be a really minor issue to me. Nonetheless it's something strange! It is the applications responsibility to provide a preference for choosing the locale. Maybe, but anyway the JVM should be able to correctly detect the default locale when this isn't done. BTW, I think that the workaround for josm can be just clearing LC_CTYPE then firing the JVM. Thanks, Giovanni. -- Giovanni Mascellani mascell...@poisson.phc.unipi.it Pisa, Italy Web: http://poisson.phc.unipi.it/~mascellani Jabber: g.mascell...@jabber.org / giova...@elabor.homelinux.org signature.asc Description: OpenPGP digital signature
Bug#608723: josm: LC_CTYPE decides language used for user interface
reassign 608723 openjdk-6-jre clone 608723 -1 retitle -1 trick josm wrapper into using the correct locale setting forcemerge 497072 608723 found 497072 6b20-1.9.2-1 affects 497072 josm thanks Hello Ansgar, On Mon, 3 Jan 2011 01:37:20 +0100, David Paleino wrote: On Mon, 03 Jan 2011 01:01:20 +0100, Ansgar Burchardt wrote: When I start josm, the interface uses Japanese by defautl even though only LC_CTYPE is set to a Japanese locale: $ locale LANG=C LANGUAGE= LC_CTYPE=ja_JP.UTF-8 LC_NUMERIC=C LC_TIME=C LC_COLLATE=C LC_MONETARY=C LC_MESSAGES=C LC_PAPER=C LC_NAME=C LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=C LC_IDENTIFICATION=C LC_ALL= locale(7) states that LC_MESSAGES should decide which language messages are displayed in, not LC_CTYPE. I'd include LANG, LANGUAGE and LC_ALL there as well. Am I wrong? However, I can confirm that even just LC_CTYPE=locale josm changes its language. I found that this really is a Java bug. See the attached code example, run it with different LC_CTYPEs and watch the results. OpenJDK maintainers: I see that the bug was forwarded to Sun's bugtracker. However, it has been marked as duplicate of another bug, which seems a totally different bug to me, and marked as fixed. However, the bug's evidently still there. Do you know whether there's some progress on this side? Ansgar: I could just trick the wrapper into setting LC_* variables. I see that with: $ LC_ALL=it_IT.UTF-8 LC_CTYPE=C josm I no longer have messages in English (as LC_CTYPE=C would imply), but in Italian. It seems that LC_ALL has higher priority over LC_CTYPE. Please continue discussion on the cloned bug number :) Kindly, David -- . ''`. Debian developer | http://wiki.debian.org/DavidPaleino : :' : Linuxer #334216 --|-- http://www.hanskalabs.net/ `. `'` GPG: 1392B174 | http://deb.li/dapal `- 2BAB C625 4E66 E7B8 450A C3E1 E6AA 9017 1392 B174 import java.util.Locale; class LocaleTest { public static void main(String[] args) { Locale l = Locale.getDefault(); System.out.println( Language, Country, Variant, Name); System.out.println(); System.out.println(Default locale: ); System.out.println( +l.getLanguage()+, +l.getCountry()+, +, +l.getVariant()+, +l.getDisplayName()); } } signature.asc Description: PGP signature
Bug#608723: josm: LC_CTYPE decides language used for user interface
Hi, On Mon, Jan 3, 2011 at 9:53 AM, David Paleino d.pale...@gmail.com wrote: I found that this really is a Java bug. no, not really. The page at http://java.sun.com/developer/technicalArticles/J2SE/locale/ explains: Depending on the default locale is not wise. In multiuser applications, a single default locale is usually not appropriate for everyone using the system. Instead your application should explicitly provide a preference to all locale-sensitive objects. It is the applications responsibility to provide a preference for choosing the locale. Cheers, Torsten -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Bug#608723: josm: LC_CTYPE decides language used for user interface
On Mon, 3 Jan 2011 10:23:24 +0100, Torsten Werner wrote: Hi, On Mon, Jan 3, 2011 at 9:53 AM, David Paleino d.pale...@gmail.com wrote: I found that this really is a Java bug. no, not really. The page at http://java.sun.com/developer/technicalArticles/J2SE/locale/ explains: Depending on the default locale is not wise. In multiuser applications, a single default locale is usually not appropriate for everyone using the system. Instead your application should explicitly provide a preference to all locale-sensitive objects. It is the applications responsibility to provide a preference for choosing the locale. So? The LC_* and LANG* settings count nothing? Every application decides whether to use LC_CTYPE, LC_ALL, LC_MESSAGES, or LC_FOO? Given they fixed it in JDK7, as noted in the upstream bug, then yes, it seems they call it a bug. :) Kindly, David -- . ''`. Debian developer | http://wiki.debian.org/DavidPaleino : :' : Linuxer #334216 --|-- http://www.hanskalabs.net/ `. `'` GPG: 1392B174 | http://deb.li/dapal `- 2BAB C625 4E66 E7B8 450A C3E1 E6AA 9017 1392 B174 signature.asc Description: PGP signature
Bug#608723: josm: LC_CTYPE decides language used for user interface
Package: josm Version: 0.0.svn3376-1 Severity: normal Tags: l10n When I start josm, the interface uses Japanese by defautl even though only LC_CTYPE is set to a Japanese locale: $ locale LANG=C LANGUAGE= LC_CTYPE=ja_JP.UTF-8 LC_NUMERIC=C LC_TIME=C LC_COLLATE=C LC_MONETARY=C LC_MESSAGES=C LC_PAPER=C LC_NAME=C LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=C LC_IDENTIFICATION=C LC_ALL= locale(7) states that LC_MESSAGES should decide which language messages are displayed in, not LC_CTYPE. Regards, Ansgar -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Bug#608723: josm: LC_CTYPE decides language used for user interface
tags 608723 confirmed found 608723 0.0.svn3751-1 thanks Hello Ansgar, On Mon, 03 Jan 2011 01:01:20 +0100, Ansgar Burchardt wrote: When I start josm, the interface uses Japanese by defautl even though only LC_CTYPE is set to a Japanese locale: $ locale LANG=C LANGUAGE= LC_CTYPE=ja_JP.UTF-8 LC_NUMERIC=C LC_TIME=C LC_COLLATE=C LC_MONETARY=C LC_MESSAGES=C LC_PAPER=C LC_NAME=C LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=C LC_IDENTIFICATION=C LC_ALL= locale(7) states that LC_MESSAGES should decide which language messages are displayed in, not LC_CTYPE. I'd include LANG, LANGUAGE and LC_ALL there as well. Am I wrong? However, I can confirm that even just LC_CTYPE=locale josm changes its language. Thank you for your report, I'll work on it ASAP, David -- . ''`. Debian developer | http://wiki.debian.org/DavidPaleino : :' : Linuxer #334216 --|-- http://www.hanskalabs.net/ `. `'` GPG: 1392B174 | http://deb.li/dapal `- 2BAB C625 4E66 E7B8 450A C3E1 E6AA 9017 1392 B174 signature.asc Description: PGP signature