Personal tools

OpenEMR Internationalization Development Guide

From OpenEMR Project Wiki

Jump to: navigation, search


Translation function

The translation is done by the xl() custom function, which can be found at openemr/library/ Its semantics are very simple.
Which with examples means:
xl('translate this')
By default the function will return the translation. First it uses the LANGUAGE constant defined to pick the translation. Second it goes for the translation, if none is found, then the same string entered is used and returned as is. Another example of use includes:
 echo ("this and " . xl('translate this') . " that too");

Also note that comments can be included in the constants (and definitions) to help provide context for some constants to translators. For example, the constant to can be confusing in Dutch, where using to for ranges (ie. <date> to <date>) is different than when addressing where a message is going to (ie. to Brady). So, can place a comment in code, such below to specify how the constant is being used:
The translation engine removes the comment, of course, when displaying it. See this wiki page to see the current constants that contain comments.

To find more options for translation look within:
 $para_class = attr($db_data); //is escaped(including quotes)
 $para_content = text($user_data); //is escaped(not including quotes)
 $title_text = xla('My Title'); //is translated and escaped(including quotes) 
 $header_text = xlt('My Header'); //is translated and escaped(not including quotes) 
 echo "<h3>$header_text</h3><p class='$para_class' title='$title_text'>$para_content</p>\n" 
 See more at: 

Further details and rules on use can be found on the wiki here Development Policies - Internationalization
There are also wrappers to the xl() function that are used infrequently in specific situations. Please refer to openemr/library/ for more details.

Translation Pipeline

For those interested in the actual software/scripts (pipeline) that created the online google docs translation spreadsheet and then utilizes it for insertion in OpenEMR; they are kept in this directory (The README file is the best place to get an overview of the process):

Translation Development Discussions

Here are the Previous sourceforge forums threads related to the internationalization project:
General Topic Threads
Specific Topic Threads