Difference between revisions of "LRM Properties Support"
(→Example of .properties) |
(→Example of Project Definition File) |
||
Line 51: | Line 51: | ||
<lrmconf> |
<lrmconf> |
||
<model-version>3.0.18</model-version> |
<model-version>3.0.18</model-version> |
||
− | <project-name> |
+ | <project-name>statistic</project-name> |
− | <project-desc> |
+ | <project-desc>Statistic project</project-desc> |
− | <group-name> |
+ | <group-name>fseng</group-name> |
− | <top-level-dir>/var/lib/jenkins/jobs/Lingoport. |
+ | <top-level-dir>/var/lib/jenkins/jobs/Lingoport.statistic/workspace</top-level-dir> |
<detect-errors> |
<detect-errors> |
||
<missed-trans-error>0</missed-trans-error> |
<missed-trans-error>0</missed-trans-error> |
||
<parameter-mismatch-error>1</parameter-mismatch-error> |
<parameter-mismatch-error>1</parameter-mismatch-error> |
||
</detect-errors> |
</detect-errors> |
||
− | <track-back-locale/> |
+ | <track-back-locale>br</track-back-locale> |
− | <pseudo-locale/> |
+ | <pseudo-locale>eo</pseudo-locale> |
<target-locales> |
<target-locales> |
||
<locale>de</locale> |
<locale>de</locale> |
||
<locale>es</locale> |
<locale>es</locale> |
||
<locale>fr</locale> |
<locale>fr</locale> |
||
+ | <locale>it</locale> |
||
<locale>ja</locale> |
<locale>ja</locale> |
||
− | <locale> |
+ | <locale>ru</locale> |
</target-locales> |
</target-locales> |
||
<default-locale>en</default-locale> |
<default-locale>en</default-locale> |
||
<resource-extensions> |
<resource-extensions> |
||
− | + | <resource-extension> |
|
− | + | <extension>properties</extension> |
|
− | + | <file-name-pattern>*_l_c_v</file-name-pattern> |
|
− | + | <use-pattern-on-dflt-locale>0</use-pattern-on-dflt-locale> |
|
− | + | <file-location-pattern/> |
|
+ | <base-file-encoding>UTF-8</base-file-encoding> |
||
− | '''<use-location-pattern-on-dflt-locale>0</use-location-pattern-on-dflt-locale>''' |
||
− | + | <localized-file-encoding>UTF-8</localized-file-encoding> |
|
+ | <parameter-regex-pattern><![CDATA[\{\w+\}|\$\d*[A-Za-z_][A-Za-z0-9_]*([\.][A-Za-z_0-9]+)*|%[ds]]]></parameter-regex-pattern> |
||
− | '''<localized-file-encoding>UTF-8</localized-file-encoding>''' |
||
+ | </resource-extension> |
||
− | '''<parameter-regex-pattern><![CDATA[%d|%s|%d+$s|%d+$d|%\{w+\}]]></parameter-regex-pattern>''' |
||
− | '''</resource-extension>''' |
||
</resource-extensions> |
</resource-extensions> |
||
− | + | <dirset> |
|
<includes> |
<includes> |
||
<include-dir>**/**</include-dir> |
<include-dir>**/**</include-dir> |
||
</includes> |
</includes> |
||
<excludes> |
<excludes> |
||
− | <exclude-dir-file>**/ |
+ | <exclude-dir-file>**/log4j.properties</exclude-dir-file> |
− | <exclude-dir-file>**/ |
+ | <exclude-dir-file>**/*_eo.properties</exclude-dir-file> |
− | <exclude-dir-file>**/ |
+ | <exclude-dir-file>**/test/**/*.properties</exclude-dir-file> |
− | <exclude-dir-file>**/catalina.properties</exclude-dir-file> |
||
− | <exclude-dir-file>**/config.properties</exclude-dir-file> |
||
− | <exclude-dir-file>**/grinder.properties</exclude-dir-file> |
||
− | <exclude-dir-file>**/integration.properties</exclude-dir-file> |
||
− | <exclude-dir-file>**/logging.properties</exclude-dir-file> |
||
− | <exclude-dir-file>**/values-eo/**</exclude-dir-file> |
||
− | <exclude-dir-file>**/values-xx/**</exclude-dir-file> |
||
− | <exclude-dir-file>**/LRMScans/**</exclude-dir-file> |
||
− | <exclude-dir-file>**/GlobalyzerScans/**</exclude-dir-file> |
||
</excludes> |
</excludes> |
||
</dirset> |
</dirset> |
||
− | + | </lrmconf> |
Revision as of 16:38, 22 September 2016
Naming Conventions
For optimum use of LRM, we strongly recommend that base files be named uniquely. If you have two files for instance, do not name them both resources.properties
. Name them something different, like resources.properties
and messages.properties
Properties files are used by applications written in many programming languages, such as Java. Java for instance has a full fledged standard infrastructure to handle resources (strings mostly) from properties files. Typically, an application will have many .properties
base files located under different directories. The base file typically does not have a locale suffix as it serves as the default locale when resources are missing in another locale.
See https://docs.oracle.com/javase/tutorial/essential/environment/properties.html .
For a base file named resources.properties
, the corresponding French file will be in the same directory and the locale will be added to the file name: resources_fr.properties
.
For example, for a few locales, the directory structure and file names would be:
messages.properties messages_de.properties messages_es.properties messages_fr.properties messages_ru.properties messages_zh.properties
The bold file is the base file (U.S. English in this instance) translated into German, Spanish, French, Russian, and Chinese.
Example of .properties
byTheFollowingAdministrator= by the following administrator: {0} artifactChangeNotification.Ownership=the request for notification of any change to a {0} you own. firstLastName={0} {1} user.confirm.delete=Are you sure you want to delete {0}?\\n\\nTHERE IS NO UNDO for deleting Users. user.editor.save.error=<strong>The User could not be saved.</strong><br/>\ Please correct the errors identified below and click one of the "Save" buttons.<br/> # # bind and validation errors # User.invalidValueError.name=User Name must be a valid email address.
Note:
- \ at the end of a string means the following line is part of that string, as in
user.editor.save.error=<strong>The User could not be saved.</strong><br/>\ Please correct the errors identified below and click one of the "Save" buttons.<br/>
- Parameters are typically numbers in braces, as in
firstLastName={0} {1}
- Comments are specified with a # sign at the beginning of the line
# bind and validation errors
Example of Project Definition File
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <lrmconf> <model-version>3.0.18</model-version> <project-name>statistic</project-name> <project-desc>Statistic project</project-desc> <group-name>fseng</group-name> <top-level-dir>/var/lib/jenkins/jobs/Lingoport.statistic/workspace</top-level-dir> <detect-errors> <missed-trans-error>0</missed-trans-error> <parameter-mismatch-error>1</parameter-mismatch-error> </detect-errors> <track-back-locale>br</track-back-locale> <pseudo-locale>eo</pseudo-locale> <target-locales> <locale>de</locale> <locale>es</locale> <locale>fr</locale> <locale>it</locale> <locale>ja</locale> <locale>ru</locale> </target-locales> <default-locale>en</default-locale> <resource-extensions> <resource-extension> <extension>properties</extension> <file-name-pattern>*_l_c_v</file-name-pattern> <use-pattern-on-dflt-locale>0</use-pattern-on-dflt-locale> <file-location-pattern/> <base-file-encoding>UTF-8</base-file-encoding> <localized-file-encoding>UTF-8</localized-file-encoding> <parameter-regex-pattern><![CDATA[\{\w+\}|\$\d*[A-Za-z_][A-Za-z0-9_]*([\.][A-Za-z_0-9]+)*|%[ds]]]></parameter-regex-pattern> </resource-extension> </resource-extensions> <dirset> <includes> <include-dir>**/**</include-dir> </includes> <excludes> <exclude-dir-file>**/log4j.properties</exclude-dir-file> <exclude-dir-file>**/*_eo.properties</exclude-dir-file> <exclude-dir-file>**/test/**/*.properties</exclude-dir-file> </excludes> </dirset> </lrmconf>