Localyzer Projects
Contents
Creating a project in Jenkins
New project
LRM creates projects using a Project Definition XML file that contains information about the resources and types for translation and then calling the Create Project Command.
This is automated in Jenkins with the Lingoport plugin.
To create a new project:
- Select New Item from the menu on the left
- In the dialog box, enter the name of the new project. The name must be of the form <group>.<project>, where the group is the name associated with the LRM license. If you are unsure about the group name, a Jenkins job called <group>.LicenseExpiration should have been created at installation. Use that <group> name.
- In the Copy from box, enter Lingoport.SampleLRM or LingoportSampleLiteLRM.
Note-a project can be created using either the project definition file directly on the command line or through the Jenkins LRM Plugin.
Configure the project
Set the git directory
Set the Project url to the URL for the GitHub repository with the code.
Set the repository info and the branch name for the code.
Set up the Git Repository and the branch
Make sure that the Repository URL and the Branch Specifier are correct.
Set the General Settings and Locales
The Top Level Directory is defaulted to $WORKSPACE. That means that LRM looks at the whole repository to find the resource files. This can be changed to look at only specific directories if you know where the resource files are kept.
The Send Unique Filenames checkbox is unchecked. Check this if the resource files are in the form:
folder1: en_US.properties folder2: en_US.properties
There are two resource files called en_US.properties
. These will be given unique filenames in the prep kit when sent to the translation system and then imported back to the correct location.
Any number of locales in various formats including LCID can be entered.
Set up the Resource File Extensions
- In this example, the resource file type extension and parser type is 'properties' and 'rc'.
- We are using the default Parameter Regex Pattern.
- The Filename pattern is *_l_c_v which means that it expects filenames to be in the form 'something_xx_yy.properties'.
- Since Use Pattern on Default Locale is checked, LRM will look for the Filename pattern on the resource file for the default locale.
- File Location Pattern is empty, so all the resource files will be located in the same directory.
- Use Location Pattern on Default Locale is unchecked. It can't be checked if File Location Pattern is empty, but it tells what the directories will look like for the base and translated resources.
- Using these variables, the Jenkins job gives and example of the Base Resource File. It should be of the form
file1_en_us.properties
and the target resources will be of the formfile1_zh_hans_tw.properties
. If the resource files do not conform to these settings, errors and missed files might occur.
Set the directories and emails
- The Include Directory/File defaults to
**/**
. All the code in the repository is included. More directories or files can be included. - The Exclude Directory Files have pre-filled entries for
**\*_eo.properties
(any pseudo-localized files),**/LRMScans/**,**/GlobalyzerScans/**
and**/sonar-project.properties
(all Lingoport files that don't have repos). More files can be excluded as needed. - The email addresses need to be set up to indicate who should receive the various notifications. More than one address can be set for each notification.
Save the values and return to the Jenkins menu. Enable the project, if it is disabled and select Build Now from the menu to create the new project.
Check the Results
After the project builds, there is a red or blue indicator under the job's Build History. Select the indicator to see the Console Output for the newly created job.
The Console Output can be daunting, but there are a few things to verify.
- Since this is the first time running, the Project Definition File and several other configuration files will be created.
- Verify that ERROR does not occur anywhere in the output.
- At the bottom of the the output, it should say ANALYSIS SUCCESSFUL and END UPDATE DASHBOARD.
At this point, the Lingoport Dashboard should have been updated with the project information.
If any of these criteria are not met, troubleshoot the project before moving forward.
The Project Definition File
<lrmconf> <model-version>5.1</model-version> <project-name>NewLRMProject</project-name> <project-desc/> <group-name>Acme</group-name> <top-level-dir>/var/lib/jenkins/jobs/Acme.NewLRMProject/workspace/</top-level-dir> <send-unique-file-names>0</send-unique-file-names> <detect-errors> <missed-trans-error>0</missed-trans-error> <parameter-mismatch-error>1</parameter-mismatch-error> </detect-errors> <default-locale>en_US</default-locale> <pseudo-locale>eo</pseudo-locale> <target-locales> <locale>fr_FR</locale> <locale>fr_CA</locale> <locale>es_MX</locale> </target-locales> <resource-extensions> <resource-extension> <extension>properties</extension> <parser-type>properties</parser-type> <file-name-pattern>*_l_c_v</file-name-pattern> <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> <parameter-regex-pattern><![CDATA[\{\w+\}|%[ds]]]></parameter-regex-pattern> </resource-extension> <resource-extension> <extension>rc</extension> <parser-type>rc</parser-type> <file-name-pattern>*_l_c_v</file-name-pattern> <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> <parameter-regex-pattern><![CDATA[%\d+]]></parameter-regex-pattern> </resource-extension> </resource-extensions> <dirset> <includes> <include-dir-file>**/**</include-dir-file> </includes> <excludes> <exclude-dir-file>**/bin/**</exclude-dir-file> <exclude-dir-file>**/LRMScans/**</exclude-dir-file> <exclude-dir-file>**/GlobalyzerScans/**</exclude-dir-file> </excludes> </dirset> </lrmconf>
<project-name>NewLRMProject</project-name>
- the name of the project<project-desc/>
- the description of the project that was given<group-name>Acme</group-name>
- the group for the project. In Jenkins, the job will be <group-name>.<project-name><top-level-dir>/var/lib/jenkins/jobs/Acme.NewLRMProject/workspace/</top-level-dir>
- The Jenkins jobs directory where the code repository will be cloned to for scanning.<send-unique-file-names>0</send-unique-file-names>
-'0' indicates unchecked (false)<default-locale>en_US</default-locale>
- the base resource (US English)<pseudo-locale>eo</pseudo-locale>
- the locale to use for pseudo-localization.<target-locales>
- the locales to translate to.<resource-extensions>
- group of the resource extensions, like.json, .properties, .xml
<resource-extension>
- a stanza for one resource extension<extension>properties</extension>
- the resource extension. LRM will look for files of the form<filename>.properties
<parser-type>properties</parser-type>
- a file of the form<filename>.properties
will be parsed as a .properties file.<file-name-pattern>*_l_c_v</file-name-pattern>
- the translated file will be of the <filename>_l_c_v.properties. For example<filename>_fr_FR.properties
or<filename>_zh_hans_tw.properties
or<filename>_no.properties
<use-pattern-on-dflt-locale>1</use-pattern-on-dflt-locale>
-'1' (true) says that the default locale will have a locale pattern, like<filename>_en_US.properties
. If this were '0' (false), the base file would look like<filename>.properties
.
<includes>
- files to include to look for the resource files<excludes>
- files that are not resource files.
How can I tell if my LRM project is setup correctly?
If the LRM Jenkins job fails when creating an LRM project, fix those failures before moving forward. If there are ERRORs in the Jenkins job output, but the job passes, debug those errors before moving forward.
Once an LRM project is set up, check that it looks correct on the Lingoport Dashboard. Select the project name from the main menu and then select the Dashboard pulldown and Resource Manager.
On the Dashboard,
- There should not be any critical errors (they will be in red)
- The Default Locale should be set to the locale that was set up.
- The Locale list should be the same set up in Jenkins.
- The numbre of Base Resource Files should be resonable.
- If you hover the mouse over Next Prep Kit Content, a list of resource files will come up (as long as there are resource files to prep).
The project inspect reports are created upon creation of LRM project. Otherwise, they can be run again from a command line:
> java -jar lrm-cli.jar -r -pi -pn <ProjectName> -gn <GroupName> > java -jar lrm-cli.jar --report --project-inspect --project-name <ProjectName> --group-name <GroupName> The following reports were generated: /var/lib/jenkins/Lingoport_Data/LRM/<GroupName>/reports/<ProjectName>/ProjectInspect_en_us.xml /var/lib/jenkins/Lingoport_Data/LRM/<GroupName>/reports/<ProjectName>/ProjectInspect_de_de.xml /var/lib/jenkins/Lingoport_Data/LRM/<GroupName>/reports/<ProjectName>e/ProjectInspect_fr_fr.xml /var/lib/jenkins/Lingoport_Data/L10nStreamlining/<GroupName>/projects/<ProjectName>/reports/project_inspect_files.txt Process completed successfully.
This command generates reports in your reports folder for each locale specified in the project definition file. Each report shows the location of the resource files, the number of files to be translated, and the file names.
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <LRMProjectInspectResults projectID="217" projectName="YourProjectName" topLevelDirector y="/location/of/files/resources"> <locale>en_US</locale> <isBaseLocale>true</isBaseLocale> <nbFiles>3</nbFiles> <results> <result file="/file1.json"/> <result file="/file2.properties"/> <result file="/file3.rjs"/> </results> </LRMProjectInspectResults>
In addition, file project_inspect_files.txt is created listing all of the absolute paths of the corresponding target files for each base resource file. The following is an example where:
- The group name is GroupName
- The project name is YourProjectName
- The top level source directory defined in the project definition is location/of/files/resources
- In the project definition, extension json has a name of pattern of *.l_c_v. The default locale files for this extension does not use the name pattern. There is no location pattern.
- In the project definition, extension properties has a name of pattern of *_l_c_v. The default locale files for this extension does not use the name pattern. There is no location pattern.
- In the project definition, extension rjs has a name of pattern of *-l-c-v. The default locale files for this extension does not use the name pattern. There is no location pattern.
/var/lib/jenkins/jobs/GroupName.YourProjectName/workspace/location/of/files/resources/file1.fr_fr.json /var/lib/jenkins/jobs/GroupName.YourProjectName/workspace/location/of/files/resources/file1.es_mx.json /var/lib/jenkins/jobs/GroupName.YourProjectName/workspace/location/of/files/resources/file2_fr_fr.properties /var/lib/jenkins/jobs/GroupName.YourProjectName/workspace/location/of/files/resources/file2_es_mx.properties /var/lib/jenkins/jobs/GroupName.YourProjectName/workspace/location/of/files/resources/file3-fr-fr.rjs /var/lib/jenkins/jobs/GroupName.YourProjectName/workspace/location/of/files/resources/file3-es-mx.rjs
You may need to edit your project definition. See Project Definition for information about configuring a LRM project.
Why, when I create a project, do I get an error stating that no resource files were found (Error 500)?
This is a pretty common error and generally easy to fix. It sounds as if your project is not setup correctly. Check the Project Definition File used to create the project or open the Jenkins job Configuration.
On the command line to check the Project Definition File:
> vi /var/lib/jenkins/Lingoport_Data/LRM/<group-name>/reports/<project-name>/ProjectDefinition.xml
The items to check (with the project definition file xml and the Jenkins configuration name) are:
- <top-level-dir> or Top Level Directory- this is the path to the source code (resource files) for the LRM Project. For example if you have
$WORKSPACE/resources
or<top-level-dir>/var/lib/jenkins/jobs/CET.Smoke/workspace/resources</top-level-dir>
but the resource files are in/var/lib/jenkins/jobs/CET.Smoke/workspace/locales
, then LRM will not find the resource files.
<top-level-dir>/var/lib/jenkins/path/to/my/resource_files</top-level-dir>
- Patterns for your resource file names:
- <file-name-pattern>...</file-name-pattern> or Filename Pattern - verify that the separator characters are correct for your localized resource file names. For example, if your French Canadian localized resource file names are of the form
myResources_fr_CA.properties
then set the following:<file-name-pattern>*_l_c_v</file-name-pattern>
- <use-pattern-on-dflt-locale>...</use-pattern-on-dflt-locale> or Use Pattern on Default Locale - Set to "1" (or checked) (true), it indicates you will use base resource files that include the default locale in their filenames. For example, if the default locale is set to "en_US" and the file-name-pattern for "properties" resource files is set to "*_l_c_v", then LRM will look for
myResources_en_US.properties
when creating a kit of files to be sent out for translation. If set to "0" (or unchecked) (false), then LRM will look for base resource files that do not have the default locale as part of their filenames. Using our "properties" file example, LRM will look formyResources.properties
when creating files for translation.<use-location-pattern-on-dflt-locale>0</use-location-pattern-on-dflt-locale>
- <file-location-pattern>...</file-location-pattern> or File Location Pattern - verify that the separator characters are correct. For example, if it is set to *-l-c-v and the base resource files are in a
files
directory then the translated files will go intofiles-fr-FR
for a french locale. If<use-location-on-dflt-locale>1</use-location-on-dflt-locale>
or Use Location Pattern on Default Locale is checked (true), then the base resource files need to be in a folder that looks likefiles-en-US
.
- <file-name-pattern>...</file-name-pattern> or Filename Pattern - verify that the separator characters are correct for your localized resource file names. For example, if your French Canadian localized resource file names are of the form
- <include-dir>...</include-dir> or Include Directories - verify that the value is a valid Ant formatting directive. If there is no value then only those files directly under the base-src-dir + top-level-dir will be searched; no recursive search will occur. To include all folders under the full path, enter a value of **/**. You can then exclude other folders by adding additional exclude Ant directives. Format for <include-dir> is:
<include-dir>**/**</include-dir>
- <exclude-dir-file>...</exclude-dir-file> or Exclude Directory Files - verify that the value is a valid Ant formatting directive and that you're not excluding valid files/folders. Format for <exclude-dir> is:
<exclude-dir-file>...</exclude-dir-file>