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 24 Next »

Custom Messages 1.2 is now available!

We are proud to announce that an initial version of in-page localization engine is now widely available in module repository within Custom Messages Module distribution package. This version of module is compatible with each major version of OpenMRS starting from 1.6 line inclusive. Source code of this version is available from OpenMRS GitHub repository within branch called v1.2.

At the moment, Google Chrome 19+ is the preferred browser, Firefox 11+ has some issues (especially with button labels) through v1.3, and Safari is not yet supported. 

What this module does

This module provides the ability to customize text messages within OpenMRS web pages and persist them within the database and can be used to translate OpenMRS directly within the web application. Also, this module provides an export feature that allows you to choose from the list of available locales and export all existing messages (both those that came from the properties files and those customized by the module) in the form of a messages_xxx.properties that can be used to provide translations for the OpenMRS web application or for other modules.

Within this module the original messages.properties files are retained as the primary message source.  The messages stored in the custommessage module tables can override these values.  So, only customizations made by an implementation are stored in the custommessage tables. This means that if core or module message.properties files are updated (e.g., during an upgrade), the customizations will be maintained.  It is easy to see exactly what has been changed and what is standard.

User documentation / How-To

Download

https://modules.openmrs.org/modules/view.jsp?module=custommessage

Screenshots

Among the other things 1.2 release of Custom Messages Module brings pretty handy and unobtrusive possibility to run your OpenMRS application in two modes: normal and translate. In normal mode an OpenMRS application runs as usual, and in translate mode, in turn, it runs with some special capabilities allowing the text on pages to me customized in-line. 

As any legacy OpenMRS module, installing of it into your system does not require to do any extra work, just use OpenMRS administration page for managing modules and upload custommessage-1.2.omod distribution package into your system. Once the module is installed you'll be able to see Translate ON/OFF button at the left bottom corner of the page as it shown on snapshot below:
This button is used for toggling translate mode on/off. So, to activate in-line customization just toggle that button ON. Page will be reloaded automatically, so, you'll see the button caption that say that translate mode is currently activated (see the snapshot below the paragraph). After enabling in-place customization, you can go down and select the locale to do translations for.


After you enabled translate mode, there is no obstacle to start with translation of messages. Just mouse click on text, that you'd like to edit, block of text becomes a form. Then you may edit contents and press enter key. New text is sent to OpenMRS server and saved into database. Form becomes normal text again. 


In this way you can translate any other text message you like: labels, button captions, form field captions, table column headers, error messages, heading elements or just even navigation links. 

It worth to say that if you want to navigate between OpenMRS pages using links, you simply need to double-click on desired link. First click makes a link text editable, and the second activates natural link behavior. 

Unfortunately, this version of module does not provide an ability to export only customized messages, this feature will be available with 1.3 release. For now you can use existing export functionality introduced within 1.1 version and export both customized and messages from properties file for desired locale. Please, see this page for more details.

To get more information about features, available with current release and about those which will be introduced in next release, please, have a look at Release Notes section on main module page.

Screenshots for a previous version release can be found here.

Release Notes

1.2. This release introduces principally new approach to customize text on OpenMRS web pages - in-page localization. In other words, this module allows you to do translation of OpenMRS web pages easier then ever – nearly as easy as viewing the pages. With this release we also provided new openmrs:message JSTL tag, and we encourage developers to use it as replacement of spring:message tag, because it includes all functionality provided by spring tag and extends it with ability to control tag output and enhance messaging at all. This point release addressed next tickets:

  • CSTM-2 - New OpenMRS JSTL tag called openmrs:messages (available in 1.6+), allowing to control output and enhanced messaging
  • CSTM-3 - Ability to run OpenMRS in translate mode
  • CSTM-4 - New DWR-based server side
  • CSTM-5 - Implemented in-place translations entering and editing
  • CSTM-15 - Converted spring:messages to openmrs:messages in core

1.1. First official release of module. This release introduces features allowing to do customization of messages from properties files using simple widget on admin web page and store these customization into the database table. Also provides simple export mechanism to download customized messages (together with messages from properties file for specified locale).

  • Initial alpha release

Important Information for Developers

As it was mentioned above, there is new openmrs:message JSTL tag. It was created off spring:message tag, so it includes all functionality of spring's implementation (HTML/JavaScript escaping, arguments passing, using of custom message source resolvable, etc). While we're working on 1.2 release, we converted all occurrences of spring:message to openmrs:message within each major version starting from 1.6 line. And it is advisable to use this tag everywhere you'd want to place old spring:message. So, if you had something like in your module or branch:

<spring:message code="Concept.view.title" arguments="${command.concept.name}" />

just change it to

<openmrs:message code="Concept.view.title" arguments="${command.concept.name}" />

You won't lose anything doing this, but you'll have a benefit  of the fact that your message can be translatable in-page. And even more, with this tag no longer need to add default translation for message code into properties files - just supply it with openmrs:message tag as follows:

<openmrs:message code="your.code" locale="fr">Message text goes here</openmrs:message>

the rest will be done by smart tag. As you can see, it allows text to be specified in the body of the element instead of the text attribute (so you can even forget about escaping, the tag will take care of it). And also it allows for locale attribute to define locale of text (so tags can define text for non-en locales). 

Converting all occurrences of spring:message to openmrs:message

In order to be able to supply your JSPs with more agile messaging approach then spring's one, you may want to convert all occurrences of spring:message tag to openmrs:message. Worth to say, that this is key point if you want to provide in-line translation capabilities for your pages. To do this conversion under Unix machine you need to use replace_tags.sh script from the command like like follows:

./replace_tags.sh /path/pointing/to/your/module/jsps/

Also, we will be working on providing OS-independent solution for tags conversion.

About

This module was initially developed by ~mseaton and enhanced by ~mvorobey.

  • No labels