• How to support new languages in the jsp view pages using spring MVC
Skip to end of metadata
Go to start of metadata

Spring MVC affords internationalization support (see documentation here)

How textual content is separated from jsp pages

We try to keep all textual content separate from jsp pages by putting them into properties files as key=value pairs.

resources/messages/pas/ui-html.properties

In the jsp files, the content is retrieved using Spring's message tag:

<spring:message code="KEY" />
jsp/pas/index.jsp

How to add new languages

Adding a new language is straightforward:
1) Create a new file resources/messages/pas/ui-html_XX.properties, where XX is one of the following:

Danish (da) - Dutch (nl) - English (en) - Estonian (et)
French (fr) - German (de) - Greek-Modern (el)
Italian (it) - Norwegian (no) - Norwegian Nynorsk (nn) - Korean (ko)
Portugese (pt) - Luxembourgeois* (ltz)
Spanish (es) - Swedish (sv) - Catalan (ca) - Czech(cs)
Polish (pl) - Brazilian Portuguese (pt-br) - Japanese (ja)
Russian (ru) - Croatian (hr)
Catalan (ca) - Croatian (hr) - Czech (cs) - Danish (da) - Dutch (nl)
English (en) - Estonian (et) - French (fr) - German (de)
Greek-Modern (el) - Hebrew (he) - Italian (it) - Japanese (ja)
Korean (ko) - Luxembourgeois* (ltz) - Norwegian Nynorsk (nn)
Norwegian (no) - Polish (pl) - Portugese (pt)
Brazilian Portuguese (pt-BR) - Russian (ru) - Swedish (sv)
Simplified Chinese (zh-CN) - Spanish (es) - Traditional Chinese (zh-TW)

2) Copy everything from resources/messages/pas/ui-html.properties file into the new file.
3) Replace the values in the new files with the translated text

Useful Tools

  • https://prbeditor.dev.java.net/
    • (Description from website) This application's intend is to help in the localization (l10n) of those programs that have been internationalized following the Java's standard internationalization (i18n) mechanism. In short, it allows the edition of resource bundle files. In contrast to other similar tools, it shows the keys and values of several languages at the same time, in a spreadsheet, giving a global vision of the resources files. This way it is easier to determine the level of completeness of each translation.

How to use prbeditor to translate

1. startup prbeditor: https://prbeditor.dev.java.net/ When prompted, allow access to your computer.
2. open ui-html.properties (file->open). If people already started translating WISE to your language, you will see your language in "Select Locales to Open" window. If you see it, choose it and hit OK. If you don't, just hit OK. You will be able to add your language in the next step.
3. go to Locale->New Locale. Select your language and hit OK.
4. A new column for your language should now be visible next to the default english column.
5. type translations in your language column.
6. when you want to save your work, hit the save icon (floppy disk icon) or File->save. you should now see a new file, ui-html_XX.properties, where XX is your locale.

Currently supported languages

In the TELS Portal, we currently support:

  • en (resources/messages/tels/ui-html.properties)
  • de (resources/messages/tels/ui-html_de.properties)
  • No labels

1 Comment

  1. Anonymous