<ac:structured-macro ac:name="table-plus" ac:schema-version="1" data-layout="default">
<ac:parameter ac:name="applyColStyleToCell">true</ac:parameter>
<ac:parameter ac:name="heading">0</ac:parameter>
<ac:parameter ac:name="columnTypes">s,s,s,s</ac:parameter>
<ac:parameter ac:name="multiple">false</ac:parameter>
<ac:parameter ac:name="columnAttributes">style="background:#e5e7ea;font-weight:bold,,style="background:#e5e7ea;font-weight:bold,</ac:parameter>
<ac:parameter ac:name="enableSorting">false</ac:parameter>
<ac:rich-text-body>
<table data-layout="default">
<colgroup>
<col style="width: 76.0px;" />
<col style="width: 278.0px;" />
<col style="width: 106.0px;" />
<col style="width: 266.0px;" />
</colgroup>
<tbody>
<tr>
<td>
<p><strong>Syntax</strong></p>
</td>
<td>
<p>i18nText(baseDir, key, language)</p>
</td>
<td>
<p><strong>Package</strong></p>
</td>
<td>
<p></p>
</td>
</tr>
<tr>
<td>
<p><strong>Alias</strong></p>
</td>
<td>
<p></p>
</td>
<td>
<p><strong>Pkg Usage</strong></p>
</td>
<td>
<p></p>
</td>
</tr>
</tbody>
</table>
</ac:rich-text-body>
</ac:structured-macro>
<h2>Description</h2>
<p><ac:structured-macro ac:name="excerpt" ac:schema-version="1" data-layout="default">
<ac:parameter ac:name="hidden">true</ac:parameter>
<ac:rich-text-body>
Returns the i18n text if the key can be resolved. Otherwise, the key itself will be returned.
</ac:rich-text-body>
</ac:structured-macro>
<p>Returns the i18n text if the key can be resolved. Otherwise, the key itself will be returned.</p></p>
<h2>Parameters</h2>
<ac:structured-macro ac:name="table-plus" ac:schema-version="1">
<ac:parameter ac:name="applyColStyleToCell">true</ac:parameter>
<ac:parameter ac:name="columnTypes">s,s,s,s</ac:parameter>
<ac:parameter ac:name="heading">0</ac:parameter>
<ac:parameter ac:name="multiple">false</ac:parameter>
<ac:parameter ac:name="enableSorting">false</ac:parameter>
<ac:rich-text-body>
<table data-layout="default">
<colgroup>
<col style="width: 170.0px;" />
<col style="width: 97.0px;" />
<col style="width: 108.0px;" />
<col style="width: 305.0px;" />
</colgroup>
<tbody>
<tr>
<th>
<p>Parameter name</p>
</th>
<th>
<p>Type</p>
</th>
<th>
<p>Required</p>
</th>
<th>
<p>Description</p>
</th>
</tr>
<tr>
<td>
<p>baseDir</p>
</td>
<td>
<p>String</p>
</td>
<td>
<p>Yes</p>
</td>
<td>
<p>The relative path to the properties files directory. The path is relative to cprime home.</p>
</td>
</tr><tr>
<td>
<p>key</p>
</td>
<td>
<p>String</p>
</td>
<td>
<p>Yes</p>
</td>
<td>
<p>Key for the i18ned message.</p>
</td>
</tr><tr>
<td>
<p>language</p>
</td>
<td>
<p>String</p>
</td>
<td>
<p>Yes</p>
</td>
<td>
<p>The language to use for the i18ned text.</p>
</td>
</tr>
</tbody></table></ac:rich-text-body></ac:structured-macro>
<h2>Return Type</h2>
<p><strong>String</strong></p>
<h2>Example</h2>
<p>If we have a directory called <strong>messages</strong> placed under the cprime home directory with the following properties files:</p>
<ac:structured-macro ac:name="code" ac:schema-version="1">
<ac:plain-text-body>
<![CDATA[runnerLog("UK: " + i18nText("messages", "com.mymessage.test.working", "en_UK"));
runnerLog("US: " + i18nText("messages", "com.mymessage.test.working", "en_US"));
runnerLog("US: " + i18nText("messages", "com.mymessage.test.working", "en"));
runnerLog("Test inexistent key: " + i18nText("message", "com.mymessage.test.inexistent.key", "en_US"));
runnerLog("fr_CH: " + i18nText("messages", "com.mymessage.test.working", "fr_CH"));
runnerLog("fr_FR: " + i18nText("messages", "com.mymessage.test.working", "fr_FR"));
// if the property file does not exists, the value will be returned from the default properties file if exists
runnerLog("Test inexistent property file: " + i18nText("messages", "com.mymessage.test.inexistent.property.file", "ro_RO"));]]>
</ac:plain-text-body>
</ac:structured-macro>
<h2>Note</h2>
<p><ac:structured-macro ac:name="note" ac:schema-version="1">
<ac:rich-text-body>
<p>The properties files should match the folder name and had the properties extension.</p>
</ac:rich-text-body>
</ac:structured-macro></p>
<h2>See also</h2>
<p><ac:structured-macro ac:name="contentbylabel" ac:schema-version="4">
<ac:parameter ac:name="showLabels">false</ac:parameter>
<ac:parameter ac:name="max">25</ac:parameter>
<ac:parameter ac:name="showSpace">false</ac:parameter>
<ac:parameter ac:name="cql">label = "jira_system_routine" and space = currentSpace ( )</ac:parameter>
<ac:parameter ac:name="labels">array_routines</ac:parameter>
</ac:structured-macro></p>
Info |
---|
AvailabilityThis routine is available starting with SIL Engine™ 4.5.8 |
Syntax
i18nText(baseDir, key, language)
Description
Excerpt |
---|
Returns the i18n text if the key can be resolved. Otherwise, the key itself will be returned. |
Warning |
---|
Keep in mind that after modifying properties file you have to restart the JIra. |
...
Parameter name
...
Type
...
Required
...
Description
...
baseDir
...
string
...
yes
...
The relative path to the properties files directory. The path is relative to kepler home.
...
key
...
string
...
yes
...
Key for the i18ned message.
...
language
...
string
...
yes
...
The language to use for the i18ned text.
Returns
string
Example
If we have a directory called messages placed under the kepler home directory with the following properties files:
...
property file
...
content
...
messages.properties
...
Code Block |
---|
com.mymessage.test.working = Deafulttest message. |
Code Block |
---|
com.mymessage.test.inexistent.property.file = inexisting message. |
...
messages_en_UK.properties
...
Code Block |
---|
com.mymessage.test.working = This function is working! |
...
messages_en_US.properties
...
Code Block |
---|
com.mymessage.test.working = This routine is working as exepected! |
...
messages_fr_CH.properties
...
Code Block |
---|
com.mymessage.test.working = Cette fonction fonctionne! |
...
messages_fr_FR.properties
...
Code Block |
---|
com.mymessage.test.working = Cette routine fonctionne comme prévu! |
Code Block |
---|
runnerLog("UK: " + i18nText("messages", "com.mymessage.test.working", "en_UK"));
runnerLog("US: " + i18nText("messages", "com.mymessage.test.working", "en_US"));
runnerLog("US: " + i18nText("messages", "com.mymessage.test.working", "en"));
runnerLog("Test inexistent key: " + i18nText("message", "com.mymessage.test.inexistent.key", "en_US"));
runnerLog("fr_CH: " + i18nText("messages", "com.mymessage.test.working", "fr_CH"));
runnerLog("fr_FR: " + i18nText("messages", "com.mymessage.test.working", "fr_FR"));
// if the property file does not exists, the value will be returned from the default properties file if exists
runnerLog("Test inexistent property file: " + i18nText("messages", "com.mymessage.test.inexistent.property.file", "ro_RO")); |
The results of the above code will be:
...
Note |
---|
The properties files should match the folder name and had the properties extension. |
See also
Filter by label (Content by label) | ||||||||
---|---|---|---|---|---|---|---|---|
|