jmeter-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sebb <seb...@gmail.com>
Subject Re: svn commit: r1239583 - in /jmeter/trunk: src/core/org/apache/jmeter/gui/AbstractJMeterGuiComponent.java src/core/org/apache/jmeter/util/JMeterUtils.java xdocs/changes.xml
Date Thu, 02 Feb 2012 19:55:05 GMT
On 2 February 2012 16:06, sebb <sebbaz@gmail.com> wrote:
> On 2 February 2012 12:40,  <pmouawad@apache.org> wrote:
>> Author: pmouawad
>> Date: Thu Feb  2 12:40:07 2012
>> New Revision: 1239583
>>
>> URL: http://svn.apache.org/viewvc?rev=1239583&view=rev
>> Log:
>> Bug 52552 - Help reference only works in English
>
> Unfortunately this does not work for TestBeans.

The Jenkins and Buildbot tests don't show this, because the headless
tests don't exercise the TestBeans.

> I suspect the resource cache may need to be cleared to fix this, which
> will be rather expensive if it has to be done each time help is
> invoked.
>
>> Modified:
>>    jmeter/trunk/src/core/org/apache/jmeter/gui/AbstractJMeterGuiComponent.java
>>    jmeter/trunk/src/core/org/apache/jmeter/util/JMeterUtils.java
>>    jmeter/trunk/xdocs/changes.xml
>>
>> Modified: jmeter/trunk/src/core/org/apache/jmeter/gui/AbstractJMeterGuiComponent.java
>> URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/gui/AbstractJMeterGuiComponent.java?rev=1239583&r1=1239582&r2=1239583&view=diff
>> ==============================================================================
>> --- jmeter/trunk/src/core/org/apache/jmeter/gui/AbstractJMeterGuiComponent.java (original)
>> +++ jmeter/trunk/src/core/org/apache/jmeter/gui/AbstractJMeterGuiComponent.java Thu
Feb  2 12:40:07 2012
>> @@ -21,6 +21,7 @@ package org.apache.jmeter.gui;
>>  import java.awt.Component;
>>  import java.awt.Container;
>>  import java.awt.Font;
>> +import java.util.Locale;
>>
>>  import javax.swing.BorderFactory;
>>  import javax.swing.JComponent;
>> @@ -314,8 +315,14 @@ public abstract class AbstractJMeterGuiC
>>         return JMeterUtils.getResString(getLabelResource());
>>     }
>>
>> +    /**
>> +     * Compute Anchor value to find reference in documentation for a particular
component
>> +     * @return String anchor
>> +     */
>>     public String getDocAnchor() {
>> -        return getStaticLabel().replace(' ', '_');
>> +        // Ensure we use default bundle
>> +        String label =  JMeterUtils.getResString(getLabelResource(), new Locale("",""));
>> +        return label.replace(' ', '_');
>>     }
>>
>>     /**
>>
>> Modified: jmeter/trunk/src/core/org/apache/jmeter/util/JMeterUtils.java
>> URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/util/JMeterUtils.java?rev=1239583&r1=1239582&r2=1239583&view=diff
>> ==============================================================================
>> --- jmeter/trunk/src/core/org/apache/jmeter/util/JMeterUtils.java (original)
>> +++ jmeter/trunk/src/core/org/apache/jmeter/util/JMeterUtils.java Thu Feb  2 12:40:07
2012
>> @@ -427,6 +427,22 @@ public class JMeterUtils implements Unit
>>     public static String getResString(String key) {
>>         return getResStringDefault(key, RES_KEY_PFX + key + "]"); // $NON-NLS-1$
>>     }
>> +
>> +    /**
>> +     * Gets the resource string for this key in Locale.
>> +     *
>> +     * If the resource is not found, a warning is logged
>> +     *
>> +     * @param key
>> +     *            the key in the resource file
>> +     * @param forcedLocale Force a particular locale
>> +     * @return the resource string if the key is found; otherwise, return
>> +     *         "[res_key="+key+"]"
>> +     */
>> +    public static String getResString(String key, Locale forcedLocale) {
>> +        return getResStringDefault(key, RES_KEY_PFX + key + "]", // $NON-NLS-1$
>> +                forcedLocale);
>> +    }
>>
>>     public static final String RES_KEY_PFX = "[res_key="; // $NON-NLS-1$
>>
>> @@ -455,6 +471,13 @@ public class JMeterUtils implements Unit
>>      * getResString(S,S) to be deprecated without affecting getResString(S);
>>      */
>>     private static String getResStringDefault(String key, String defaultValue)
{
>> +        return getResStringDefault(key, defaultValue, null);
>> +    }
>> +    /*
>> +     * Helper method to do the actual work of fetching resources; allows
>> +     * getResString(S,S) to be deprecated without affecting getResString(S);
>> +     */
>> +    private static String getResStringDefault(String key, String defaultValue,
Locale forcedLocale) {
>>         if (key == null) {
>>             return null;
>>         }
>> @@ -463,7 +486,11 @@ public class JMeterUtils implements Unit
>>         resKey = resKey.toLowerCase(java.util.Locale.ENGLISH);
>>         String resString = null;
>>         try {
>> -            resString = resources.getString(resKey);
>> +            ResourceBundle bundle = resources;
>> +            if(forcedLocale != null) {
>> +                bundle = ResourceBundle.getBundle("org.apache.jmeter.resources.messages",
forcedLocale); // $NON-NLS-1$
>> +            }
>> +            resString = bundle.getString(resKey);
>>             if (ignoreResorces ){ // Special mode for debugging resource handling
>>                 return "["+key+"]";
>>             }
>>
>> Modified: jmeter/trunk/xdocs/changes.xml
>> URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1239583&r1=1239582&r2=1239583&view=diff
>> ==============================================================================
>> --- jmeter/trunk/xdocs/changes.xml (original)
>> +++ jmeter/trunk/xdocs/changes.xml Thu Feb  2 12:40:07 2012
>> @@ -92,6 +92,7 @@ or a Debug Sampler with all fields set t
>>  <h3>I18N</h3>
>>  <ul>
>>  <li>Bug 52551 - Function Helper Dialog does not switch language correctly</li>
>> +<li>Bug 52552 - Help reference only works in English</li>
>>  </ul>
>>
>>  <h3>General</h3>
>>
>>

Mime
View raw message