Uploaded image for project: 'OpenMRS Core'
  1. OpenMRS Core
  2. TRUNK-1525

Enhanced message handling for localization within web pages

    Details

    • Complexity:
      Undetermined

      Description

      I've always wished that we could just enter the default translation right into the web page and then much of our default (i.e., English) message bundle could be automatically generated by scanning & parsing code-value pairs straight from the pages. This would also have the benefit of providing context for developers (rather than viewing pages with only a bunch of often cryptic message keys).

      So, instead of:

      <spring:message code="User.password.forgot" />

      with the text "I forgot my password" hidden in some message bundle that has to be manually built, the developer would just put this straight into the default web page:

      <openmrs:message code="User.password.forgot" locale="en">
      I forgot my password
      </openmrs:message>

      An ANT script could then automatically populate/update the default message.properties file for us by scanning our web pages.

      For localization, you could set a runtime property or flip a switch in the admin interface to temporarily create span tags for each message, so instead of just putting "I forgot my password" into the web page, OpenMRS would put <span class="message" id="User.password.forgot"> I forgot my password </span> into the page. With this in place, we could make a Firefox plugin that would let you run OpenMRS in this special mode, click on any text on the web page and enter the translation in a panel to the left or below the page while you're still viewing the text in context. The Firefox plugin would then build a language-specific message.property file for you in the background or simply let you click a button to display all the translation you had done in a new tab.

      Extra credit: run OpenMRS in this special mode (rendering <span> elements with the message code onto web pages) and have the Firefox plugin calling a web service method behind the scenes so that you could switch to the target language and run through the web application, translating any text that wasn't yet translated directly within the web page and the plugin would work with the OpenMRS server to update the message bundle on the fly – literally, translate the web app page-by-page from directly inside the application.

      If <spring:message /> can't handle content like I described above, then I'd propose we move to <openmrs:message /> and make it suit our needs.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                mvorobey Mykola Vorobey
                Reporter:
                burke Burke Mamlin
              • Votes:
                2 Vote for this issue
                Watchers:
                8 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: