Wiki Spaces


Get Help from Others

Q&A: Ask OpenMRS
Discussion: OpenMRS Talk
Real-Time: IRC Chat | Slack


Page tree
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

Primary mentor


Backup mentor

Rafal Korytkowski

Assigned to

Mykola Vorobey


With use Spring's message taglib for putting strings onto our web pages.  This gives us the ability to translate openmrs very easily.  If you want to put a string into a jsp page into openmrs you put this spring:message in your jsp:

<spring:message code="MyPage.personSearchFieldPrompt" />: <input type="text" value="personId" />

And then you find the file and add this:

MyPage.personSearchFieldPrompt=Enter the person id

And if you're bilingual and not too lazy you find the file and append this:

MyPage.personSearchFieldPrompt=Entra el id de la persona

Now the text can be is displayed automatically in Spanish if the user has set their locale as Spanish.  If the user is in the English locale or any other, they will see the english translation.


Its annoying to have to edit two files to add a simple string.  (Most devs only know english and so will only ever edit the one file)


Allow for in-line adding/editing of the translated text by the developer.


These are separated into mostly independent tasks that can be done by different developers.

Task #1: (Java)

Subclass the default Spring "message" taglib class and allow for text inside of the tag.  The spring.tld file in openmrs tells me that the class is org.springframework.web.servlet.tags.MessageTag.

If that text is entered in the body of the html tag by the developer, use that as the "en" translation in the message taglib class instead of looking in the file.

Task #2: (no tech knowledge needed)

Move text from the into the body of the spring tags in core.  This is a very tedious task but doesn't require a lot of java knowledge.

Task #3: (scripting knowledge helpful)

Create a shell script or ant script/target that scans the web folder looking for spring:message tags.  The script should take the 'key' from the tag and insert it into the file (but only if it doesn't exist in the file already).

The value for the key in the file should be the body content of the spring:message tag in the jsp file

Task #4: (scripting knowledge helpful)

If a volunteer comes along and says "I want to help translate openmrs in Spanish" we typically just given them the english and they turn the right side of it into spanish.  However, seeing the text in context is SOO much easier to translate.

It would be awesome to be able to see the codes and then translate right when viewing the page.  We could use a firefox plugin + custom modifications to our custom message tag (see task 1) for this:

There could be a Global Property that can be set to put the OpenmrsMessageTag into "translate mode".  So the text returned from the tag is "<span class="openmrstranslate">Enter the person id</span>.  The webapp will run just as it did before with this new entry.

However, now if we also create a Firefox Plugin (or any other browser) that looks for any html tag with "openmrstranslate" in the class attribute, the plugin could let the user click on a put in new text.  The output of what the translator enters can be saved to a file of their choice.  The file is then dropped into openmrs as the file (or whatever other language).

See Also

Interested Parties

  • No labels