JMeter language support
In this blog post we are going to discuss using JMeter localised to a language other than English.
We are not discussing computer languages that are supported.
We will look at currently supported languages and how to change your local instance to use these languages.
We will also look at how you can submit a language translation if you would like to and have the ability to.
Internationalisation and Localisation¶
Before we investigate changing our JMeter language to one other that what you may already have set, we will take a quick look at what we mean by Internationalisation and Localisation.
From this source.
In computing, internationalization and localization (American) or internationalisation and localisation (British), often abbreviated i18n and l10n respectively, are means of adapting computer software to different languages, regional peculiarities and technical requirements of a target locale.
So, as we can see from the above documentation localisation is the international standard definition for software supporting languages other than the one they were developed in and default to.
Currently supported languages¶
At the time of writing this post JMeter is internationalised completely into English and French, JMeter was developed in English and a complete translation of all aspects of JMeter have been made into French.
Other languages are supported but not fully, these are:
- Chinese / Simplified Chinese (zh_CN)
- Chinese / Traditional Chinese (zh_TW)
- German (de)
- Japanese (ja)
- Norwegian (no)
- Polish (pl)
- Portuguese / Brazilian (pt / BR)
- Spanish (es)
- Turkish (tr)
- Korean (ko)
If you have the ability to translate the missing parts of the above languages and feel like you would like to then we will discuss how to do this later in the post.
You can when JMeter is open change the language to any of the above using the Options->Choose language
menu option.
We will select Turkish, and the GUI will update to the selected language.
This is an example of a language that have been partially completed and as we can see there are still a few English words visible on the test Plan element as well as throughout other elements that JMeter uses.
If we change the language to French, we can see that there are no omissions, and all text is translated.
Persisting the language change¶
If we change the language through the menu option when JMeter is restarted the language defaults back to en_EN as this is configured in the jmeter.bat
file if you are using Windows or the jmeter.sh
file if using Linux.
Let’s look at setting the default language to French in a way that will persist, as already discussed this French fully internationalised already so will be a good example.
There are two files that we need to look at to change the GUI language configuration, we have already stated that one is the jmeter.bat
orjmeter.sh
file the other is in jmeter.properties
and this is the one we will look
at first.
This file is in the /bin
folder of your JMeter installation.
If you look in this file, you will find this line which is probably commented out.
As you can see if this is commented out is uses the JVM’s default locale’s language.
Because my default JVM language is en
then I will need to change this to fr
.
This is enough to change the language as we can see if we start JMeter.
Therefore, if you are working on a machine where the JVM is configured to a localisation that JMeter supports then you should get that language as default when you start JMeter.
The other place to configure is in the jmeter.bat
or jmeter.sh
file, depending on your operating system.
We will undo our change we have made first and comment out the language=fr
entry in the jmeter.properties
file.
We will now open the jmeter
file and if we search this file we will see:
So basically, we can set our language of choice in here also.
Let’s update our localisation preferences to be French again.
And if we restart JMeter we see:
So, we can use either approach to set our localisation for JMeter and use an alternative language in the JMeter GUI.
Contributing to existing localisations¶
As already discussed, JMeter is fully localised to English and French and partly localised to the other languages we have outlined already in this post.
We are going to look at the steps you can follow to either fill in some of the missing entries in the languages already partially supported or to add a new language that is not currently supported at all.
The Apache documentation outlines how to do this and can be found here, we will look to follow this process.
The first thing we are going to do is grab the JMeter source files from the GitHub repository.
I am using IntelliJ IDEA as my Integrated Development Environment.
As stated in the Apache localisation documentation the Git and GitHub location for the source is:
https://gitbox.apache.org/repos/asf/jmeter.git
https://github.com/apache/jmeter
If we clone this repository, we see the JMeter source code in IntelliJ.
If we open a command prompt and run the following command:
find src -name "*.properties" -o -name "*.metaprops"
We get a list of the files that manage the localisation setting in JMeter.
If we target one of the properties file, the ones for BSFAssertionResources
by running this command:
find src -name "*BSFAssertionResources*.properties" -o -name "*.metaprops"
We see that there is a properties file for some, not all, of the languages that we discussed earlier in this post.
This also shows us that not all localisations are supported for BSF Assertions.
The next step towards contributing towards JMeters support for localisations is to get the runtime for i18nEdit.
You can download the jar file from here.
Below is the definition of what i18nEdit is.
Tool for internationalization of Java and PHP projects. Allows independant translation of a project by different translators, keeps track of newly needed translations. Works on top of Java ResourceBundle system, features PHP adapter for it.
Now we have our jar file we can unpack it and look at how it is used.
From a terminal issue this command:
java -jar i18nEdit.jar
This assumes that the location you are in is on the Java PATH on your machine and that you are in the same folder as the i18nEdit jar file.
Once you have run this you will see a dialog appear.
The language you are selecting here is not the language you are translating into but the language you want the utility to be in.
For the purposes of this post, I will choose English (United Kingdom).
Once the language is selected the localisation editor appears.
We select Project and navigate to the i18nedit.properties file in the source code you downloaded from GitHub.
Once the project is open you will see this window.
We are now able to start translating.
Now I do not speak a language other than English fluently enough to translate JMeter so to demonstrate how translation works I am going to add Guernsey to the translated languages list and change all the values to be prefixed with gg_
.
I am doing this for no other reason than to show translation in this post.
If we look in the Current ISO 3166 Country Codes, which you can find here you can see that Guernsey has a county code of gg.
The first thing we do is add this as a county code to our localisation editor.
In the localisation editor select Project-> Project settings and this dialog appears.
You can see the list of languages that are already fully or partly translated in JMeter.
I am going to add gg to this list and Press Save.
We can now see in our main screen that gg has been added to the country list, there is no name or country flag yet as this is added when the change is approved and committed to the repository.
We now select Project->Translation settings
.
We have set our Source locale to be English and set our Target locale to be gg.
We press Save and the dialog closes.
We are now at this point in the documentation.
Click on one of the editable fields in the right panel ("Comment" or "Content" for your language). Press F2. i18nEdit will bring you to the first property that requires your attention, either because a translation does not yet exist for it or because the English text has changed since the translation was provided. Enter or fix the text if necessary, then press F2 again to repeat the process.
Let’s now do that.
If we select F2 from the screen we are presented with:
The first selection is BSF Assertion.
If we scroll to the bottom of the list of countries, we see our gg entry.
Before we start updating localisation values there are a few things to consider.
There are a significant number of values that can be localised, if we go back to a command prompt and issue this command:
find src -name "*.properties" -o -name "*.metaprops" | wc -l
We can see that there are 289 files.
We can see from the BSF Assertion entry we currently have displayed in the localisation editor that this has 13 resources that need translating, some have more and some less.
If we use the navigation pane on the left and navigate to:
core->src->main->resources->jmeter->resources->messages
Then there are hundreds of resources.
The number of resources that need to be translated to fully localise JMeter to any country is huge, which is probably the reason why some countries, as discussed earlier, only have partial translation.
The documentation states that you step through each resource using F2 and this is the correct way to translate JMeter if you are prepared to start at the beginning and translate everything.
If, however, you want to select some resources to translate you can do this by selecting them using the left-hand navigation pane.
Once selected you can press F2 to enter edit mode update the resources you want pressing F2 to make the changes and move to the next field.
For the purposes of this post, we are going to select JSR223TimerResources and select the first resource in the list.
We can see that this matches the values we find in the JMeter GUI.
If we go back to our localisation editor, we will set a value for each of the resources in the gg field and press F2 to move between the fields.
It is important to press F2 after each update as this moves you to the next field but more importantly saves your update, so you should not just click into another field without pressing F2 as this will not correctly save the updated values.
We update the first resource.
When we reach the last one, we update and press F2.
Before we move on to checking our updates lets have a quick look at what other functionality the localisation tool offers.
There is a search functionality that allows you to find a particular resource.
To demonstrate how this works we will select Search->Search property key
We have entered displayName
as our search string.
If we press Search, we can see that the first resource that matches this search in the currently selected location is highlighted.
If we now press F2 to move through the resources, the localisation editor will go from:
to
And ignore filename.shortDescription
.
The search functionality is very powerful and should help you find any resource you wish to translate.
Checking your updates and submitting for review¶
If we go back to our Integrated Development Environment and look at our JMeter project we cloned, we can see that we have a new file called JSR223TimerResources_gg.properties
which contains the values we inserted into the localisation editor.
And we can see that the i18nedit.properties file has been updated to include our gg data.
Finally, you need to submit your changes to the Known Bugs repository which can be found here.
From the Apache localisation documentation, you do this by following these steps.
Once you're done translating, just pack up the whole set of files in jmeter/src in a jar, zip, tar, tgz, or alike and attach them to a JMeter bug report (follow link to "Known bugs" in JMeter's home page for that).
Conclusion¶
This is just a brief look at how you can change and update your JMeter GUI language to suit your needs and gives you an insight into how you could submit a translation of your own.