Difference between revisions of "Localyzer Projects"

From Lingoport Wiki
Jump to: navigation, search
(How can I tell if my LRM project is setup correctly?)
Line 165: Line 165:
 
==How can I tell if my LRM project is setup correctly?==
 
==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'''
 
  +
  +
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'''.
   
  +
[[File:DashboardResourceManager.jpg|600px]]
  +
  +
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).
   
 
==Why, when I create a project, do I get an error stating that no resource files were found (Error 500)?==
 
==Why, when I create a project, do I get an error stating that no resource files were found (Error 500)?==

Revision as of 19:35, 20 June 2019

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.

JenkinsNewProject.jpg

To create a new project:

  1. Select New Item from the menu on the left
  2. 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.
  3. 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

GithubProject.jpg

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

JenkinsGitRepo.jpg

Make sure that the Repository URL and the Branch Specifier are correct.

Set the General Settings and Locales

JenkinsLRMSettings.jpg

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

JenkinsLRMResourceFileExtensions.jpg

  • 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 form file1_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

JenkinsDirEmails.jpg

  • 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.

BuildHistory.jpg

The Console Output can be daunting, but there are a few things to verify.

FirstTimeBuild.jpg

  • 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.

DashboardResourceManager.jpg

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).

Why, when I create a project, do I get an error stating that no resource files were found (Error 500)?