Difference between revisions of "Supported Resource Bundles"
(→Resource Extensions) |
(→Resource Extensions) |
||
Line 71: | Line 71: | ||
=== Resource Extensions === |
=== Resource Extensions === |
||
A LRM project can have multiple extensions defined. The information need per extension is: |
A LRM project can have multiple extensions defined. The information need per extension is: |
||
− | * extension - this can be one of the LRM standard extensions (see xyz) or a unique extension |
+ | * '''extension''' - this can be one of the LRM standard extensions (see xyz) or a unique extension |
− | * parser-type - A parser-type is required for a non-standard extension (see xyz) |
+ | * '''parser-type''' - A parser-type is required for a non-standard extension (see xyz) |
− | * file name pattern - if applicable, this is the pattern for the name of |
+ | * '''file name pattern''' - if applicable, this is the pattern for the name of project's resource files. For example, the translated file names ''file1_zh-Hans_HK.rc'', ''file1_fr.rc'' and ''file1_de-de.rc'' would have the pattern ''*_l-c_v''. Where ''l'' is the language, ''c'' is the country/script and ''v'' is the variant/region. |
+ | * '''use name pattern on default locale flag'''- If the base resource files use the file-name-pattern in their name then this flag is ''1'' otherwise ''0''. For example, the base resource file ''file1.rc'' does not have a pattern so the flag would be ''0''. |
||
+ | * '''file location pattern''' - if applicable, this is the pattern for the folders containing the resource files. These folder can be of 2 types: |
||
+ | ** Language pattern - For example, ''*-l_c_v'' where the folder containing the English resource files could be ''values-en''. |
||
+ | ** Microsoft LCID code pattern - For example, ''*_LCID'' where the folder containing the English resource files could be ''values_1036''. |
||
+ | * '''use location pattern on default locale flag'' - If the folder, containing the base resource files, use the pattern then this flag is ''1'' otherwise ''0''. |
||
+ | * '''encoding''' for the base and non-base resource files - Usually this will be UTF-8. |
||
+ | * '''parameter-regex-pattern''' - This defines the regex pattern for parameters such as formatting and messaging. |
||
=== Include/Exclude Files/Directories === |
=== Include/Exclude Files/Directories === |
Revision as of 18:41, 18 September 2017
Contents
What resource file types are supported by LRM?
Standard LRM extensions
- .htm and .html files using the html parser
- .json (Mostly JavaScript, and other programming languages) using the json parser
- .msg (C, C++, ...) using the msg parser
- .po files using the po parser
- .properties files (Java-type resources) using properties parser
- .resx files (used in the .Net world) using xml parser and the ResxParser.xml format definition
- .rc (Delphi, ...) using the rc parser
- .rjs (for JavaScript) using the js parser
- .rxml using the xml parser and the RxmlParser.xml format definition)
- .strings (Mobile iOS) using the strings parser
- strings.xml (Android) using the xml parser and the AndroidParser.xml format definition
Unique Extensions
Any file extension can be handled by LRM as long as the corresponding parser type is defined. The file must be able to be parsed correctly by the defined parser type or an error will occur. The parser types are:
- html parser
- js parser
- json parser
- msg parser
- po parser
- properties parser
- rc parser
- strings parser
- xml parser
Lingoport Resource Manager Configuration
LRM creates projects using a Project Definition XML file that contains information about the resources and types for translation. Here is a typical .xml definition for projects with .properties files.
Project Info
Project information includes the following:
- Project Name - the repository name. This cannot be changed once the project is created.
- Project desc - description, if any, for the project
- Group Name - the owner of the repository. This cannot be changed once the project is created.
- Top Level Directory - The top level directory is an absolute path. Usually it is something like
/var/lib/jenkins/jobs/Acme.wiley/workspace
. There are times where there is 1 repository for multiple projects. In this case the top level directory may be/var/lib/jenkins/jobs/Acme.wiley/workspace/wileyProject1
. This value cannot be changed once the project is created.
ProjectDefinition.xml example
This example is the project info for the wiley repository under the Acme group. (Under git, Acme would be the owner of the wiley repo)
<project-name>wiley</project-name> <project-desc>Wiley Project</project-desc> <group-name>Acme</group-name> <top-level-dir>/var/lib/jenkins/jobs/Acme.wiley/workspace</top-level-dir>
Jenkins Plugin Example
Detect Errors Flags
These flags direct LRM on the types of errors to detect.
- Missed Translations - If set to 1, then a Missed Translation error will occur if the base resource file text is the same as the translated file text. Usually this flag is set to 0.
- Parameter Mismatch Error - If set to 1 then a Parameter Mismatch error will occur if the parameters in the translated file do not match the base resource file parameters.
ProjectDefinition.xml example
A project setup with the following detect error flags will not detect missed translations but will detect parameter mismatch errors.
<detect-errors> <missed-trans-error>0</missed-trans-error> <parameter-mismatch-error>1</parameter-mismatch-error> <detect-errors>
Locales
There are 4 types of locales that can be defined in a project:
- Track Back locale - The locale for the project's trackback files. See Trackback files
- Pseudo Locale - The locale for the project's pseudo-locale files.
- Target locales - Must be exclusive of the project's base, trackback and pseudo-locales.
- Base Locale - The locale of the project's base resource file.
Resource Extensions
A LRM project can have multiple extensions defined. The information need per extension is:
- extension - this can be one of the LRM standard extensions (see xyz) or a unique extension
- parser-type - A parser-type is required for a non-standard extension (see xyz)
- file name pattern - if applicable, this is the pattern for the name of project's resource files. For example, the translated file names file1_zh-Hans_HK.rc, file1_fr.rc and file1_de-de.rc would have the pattern *_l-c_v. Where l is the language, c is the country/script and v is the variant/region.
- use name pattern on default locale flag- If the base resource files use the file-name-pattern in their name then this flag is 1 otherwise 0. For example, the base resource file file1.rc does not have a pattern so the flag would be 0.
- file location pattern - if applicable, this is the pattern for the folders containing the resource files. These folder can be of 2 types:
- Language pattern - For example, *-l_c_v where the folder containing the English resource files could be values-en.
- Microsoft LCID code pattern - For example, *_LCID where the folder containing the English resource files could be values_1036.
- 'use location pattern on default locale flag - If the folder, containing the base resource files, use the pattern then this flag is 1 otherwise 0.
- encoding for the base and non-base resource files - Usually this will be UTF-8.
- parameter-regex-pattern - This defines the regex pattern for parameters such as formatting and messaging.
Include/Exclude Files/Directories
This tells LRM to look for .properties resource files.
<extension>properties</extension>
Here is a sample Project Definition file to create an LRM project. This example is for .properties files. Additional <resource-extension>
stanzas can be added to include other extensions. Samples for the supported extensions can be found in <HOME>/lingoport/lrm-server-x.y/samples.
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <lrmconf> <model-version>2.0.12</model-version> <project-name>com.company.project</project-name> <project-desc>This is a sample LRM Project definition file, configured to support Java properties files</project-desc> <!--group-name contains the group name that the LRM license is under--> <group-name>SVNFTP</group-name> <top-level-dir>/var/lib/jenkins/jobs/SVNFTP.com.company.project/workspace</top-level-dir> <detect-errors> <!--If set to '0' (false), then the 'missed translation' error will not be triggered--> <missed-trans-error>0</missed-trans-error> <parameter-mismatch-error>1</parameter-mismatch-error> </detect-errors> <pseudo-locale>eo</pseudo-locale> <default-locale>en_US</default-locale> <target-locales> <locale>fr</locale> <locale>de_DE</locale> <locale>slv</locale> <locale>nob_NO_UNI</locale> <locale>zh_Hant</locale> <locale>ZHT_Hans</locale> </target-locales> <resource-extension> <extension>properties</extension> <file-name-pattern>*_l_c_v</file-name-pattern> <!--If the base resource files use the file-name-pattern in their name --> <!--then set use-pattern-on-dflt-locale to 1, if not then set to 0--> <use-pattern-on-dflt-locale>1</use-pattern-on-dflt-locale> <file-location-pattern/> <use-location-pattern-on-dflt-locale>0</use-location-pattern-on-dflt-locale> <base-file-encoding>UTF-8</base-file-encoding> <localized-file-encoding>UTF-8</localized-file-encoding> <!--Default pattern for properties is '![CDATA[\{\d+\}|%[ds]]]'--> <parameter-regex-pattern><![CDATA[\{\w+\}|%[ds]]]></parameter-regex-pattern> </resource-extension> </resource-extensions> </lrmconf>