Bug 47127 - Unable to change language to pl_PL
Unable to change language to pl_PL
Status: RESOLVED FIXED
Product: JMeter
Classification: Unclassified
Component: Main
2.3.2
PC Windows XP
: P2 minor (vote)
: ---
Assigned To: JMeter issues mailing list
:
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2009-04-30 00:55 UTC by kamil
Modified: 2009-04-30 04:51 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description kamil 2009-04-30 00:55:47 UTC
Hi!

   I received an error while trying to run JMeter:
An error occurred: Unable to change language to pl_PL

The cause was in line 325 in class JMeterUtils:

    resBund.getLocale().equals(loc)

    resBund.getLocale()
	 (java.util.Locale) pl
    loc
	 (java.util.Locale) pl_PL

I've modified it to have JMeter run in my language:

   from: resBund.getLocale().equals(loc)
   to:   resBund.getLocale().getLanguage().equals(loc.getLanguage())

   resBund.getLocale().getLanguage()
	 (java.lang.String) pl

   loc.getLanguage()
	 (java.lang.String) pl


Now it's equal, no exception is thrown, and I'm happy to see JMeter on my screen. I don't know if it's the best solution of such problem. Maybe some other way of comparing should be used? Something from java.util.Locale? Maybe you'll have a better idea, something more elegant?
Comment 1 Sebb 2009-04-30 03:39:03 UTC
Why are you setting the Locale to pl_PL and not just pl?

Is that what your JVM is set to or have you defined the JMeter "language" property?

Using "pl" works fine in the nightly builds.
Comment 2 kamil 2009-04-30 04:37:42 UTC
Hi Sebb,

   I'm selecting current locale in Start > Control Panel >  Regional Settings > first tab: Regional Options (and Advanced). I'm not passing JVM options -Duser.language=pl -Duser.region=PL to alter default (polish) locale, which I've set in 

   What variable isDefault actually stores is information 'isEnglish' (check line #308). That may puzzle a bit.

   I've checked three computers (two Windows XP PL and one Windows 2000 Server PL) and Locale.getDefault() returns: Default locale: pl_PL.

Cordially,
Kamil


................................
// Code used to check for default locale
import java.util.Locale;

public class PrintLoc {
	public static void main(String[] args) {
		System.out.println("Default locale: " + Locale.getDefault());
	}
}
Comment 3 kamil 2009-04-30 04:48:56 UTC
I have this trouble only in Eclipse. When I've downloaded package from your website and saved polish property file in proper place, it works fine.
Comment 4 Sebb 2009-04-30 04:51:44 UTC
OK, I see.

What I have done is to add a further check.

If the Locales don't match exactly, then check if they match when getLanguage()
is used. If so, log a warning (because the requested Locale was not available)
but continue.

This corresponds better with the behaviour of Resource.getBundle().

See:

URL: http://svn.apache.org/viewvc?rev=770174&view=rev
Log:
Bug 47127 -  Unable to change language to pl_PL

This will be in the nightlies from version r770174.

Thanks for the report.