Difference between revisions of "OpenEMR Internationalization Development Guide"

From OpenEMR Project Wiki
(Created page with ":For those interested in the actual software/scripts (pipeline) that created the language spreadsheet and then utilizes it for insertion in OpenEMR; they are kept in this directo...")
 
 
(12 intermediate revisions by one other user not shown)
Line 1: Line 1:
:For those interested in the actual software/scripts (pipeline) that created the language 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):
__TOC__
==Translation function==
:The translation is done by the xl() custom function, which can be found at openemr/library/translation.inc.php. Its semantics are very simple.
<pre>xl(string)</pre>
:Which with examples means:
<pre>xl('translate this')</pre>
: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:
<pre> echo ("this and " . xl('translate this') . " that too");</pre>
 
 
: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:
<pre>xl('to{{range}}')</pre>
:The translation engine removes the comment, of course, when displaying it.  [[English_Constants_Descriptions#Constants_with_comments|See this wiki page to see the current constants that contain comments.]]
 
 
:To find more options for translation look within: '''explanationhtmlspecialchars.inc.php'''
 
:: <pre> $para_class = attr($db_data); //is escaped(including quotes)</pre>
:: <pre> $para_content = text($user_data); //is escaped(not including quotes)</pre>
:: <pre> $title_text = xla('My Title'); //is translated and escaped(including quotes) </pre>
 
:: <pre> $header_text = xlt('My Header'); //is translated and escaped(not including quotes) </pre>
::: <pre> echo "<h3>$header_text</h3><p class='$para_class' title='$title_text'>$para_content</p>\n" </pre>
 
:: <pre> See more at: http://www.open-emr.org/wiki/index.php/Codebase_Security#SQL-Injection_and_Cross-Scripting_Prevention </pre>
 
 
:Further details and rules on use can be found on the wiki here [[Development_Policies#Internationalization|Development Policies - Internationalization]]
:There are also wrappers to the xl() function that are used infrequently in specific situations. Please refer to openemr/library/translation.inc.php 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):
::*http://github.com/openemr/openemr/tree/master/contrib/util/language_translations
::*http://github.com/openemr/openemr/tree/master/contrib/util/language_translations
:For those of you interested in the xl() internationalization function, then go [[OpenEMR Internationalization Configuration|HERE]].
 
==Translation Development Discussions==
:Here are the Previous sourceforge forums threads related to the internationalization project:
:Here are the Previous sourceforge forums threads related to the internationalization project:
::General Topic Threads
::General Topic Threads
:::*[http://sourceforge.net/projects/openemr/forums/forum/202506/topic/3439721 Most Recent]
:::*[http://sourceforge.net/p/openemr/discussion/202506/thread/83bc0f77 Most Recent]
:::*[http://sourceforge.net/projects/openemr/forums/forum/202506/topic/3279061 Third]
:::*[http://sourceforge.net/projects/openemr/forums/forum/202506/topic/3279061 Third]
:::*[http://sourceforge.net/projects/openemr/forums/forum/202506/topic/3130655 Second]
:::*[http://sourceforge.net/projects/openemr/forums/forum/202506/topic/3130655 Second]
Line 11: Line 46:
:::*[http://sourceforge.net/projects/openemr/forums/forum/202506/topic/3673130/ Discussion on the new translation customization and logging module (releasing with version 4.0)]
:::*[http://sourceforge.net/projects/openemr/forums/forum/202506/topic/3673130/ Discussion on the new translation customization and logging module (releasing with version 4.0)]
:::*[http://sourceforge.net/projects/openemr/forums/forum/202506/topic/3509701 Discussion on parametric translations and also discussion to further improve the backend (google docs spreadsheet) processing]
:::*[http://sourceforge.net/projects/openemr/forums/forum/202506/topic/3509701 Discussion on parametric translations and also discussion to further improve the backend (google docs spreadsheet) processing]
:The translation is done by the xl() custom function, which can be found at openemr/library/translation.inc.php. Its semantics are very simple.
<pre>xl(string)</pre>
:Which with examples means:
<pre>xl('translate this')</pre>
: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:
<pre>echo ("this and " . xl('translate this') . " that too");</pre>
:Further details and rules on use can be found on the wiki here [[Development_Policies#Internationalization|Development Policies - Internationalization]]
:There are also wrappers to the xl() function that are used infrequently in specific situations. Please refer to openemr/library/translation.inc.php for more details.


[[Category:Internationalization]][[Category:Developer Guide]]
[[Category:Internationalization]][[Category:Developer Guide]]

Latest revision as of 23:44, 16 April 2014

Translation function

The translation is done by the xl() custom function, which can be found at openemr/library/translation.inc.php. Its semantics are very simple.
xl(string)
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:
xl('to{{range}}')
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: explanationhtmlspecialchars.inc.php
 $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: http://www.open-emr.org/wiki/index.php/Codebase_Security#SQL-Injection_and_Cross-Scripting_Prevention 


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/translation.inc.php 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