Difference between revisions of "Localyzer Configuration FAQ"

From Lingoport Wiki
Jump to: navigation, search
(Created page with "== Resource Manager Configuration == == Resource Manager Client Configuration == Two files are used to configure the Resource Manager client: <UL> <LI><B>application.proper...")
 
 
(36 intermediate revisions by 3 users not shown)
Line 1: Line 1:
== Resource Manager Configuration ==
 
 
   
   
== Resource Manager Client Configuration ==
+
== Resource Manager Configuration ==
 
Two files are used to configure the Resource Manager client:
 
Two files are used to configure the Resource Manager client:
 
<UL>
 
<UL>
 
<LI><B>application.properties</B>: it is set up during installation and should not be need to be modified. It indicates how to connect to the Resource Manager database and in what locale the log file should be written.</LI>
 
<LI><B>application.properties</B>: it is set up during installation and should not be need to be modified. It indicates how to connect to the Resource Manager database and in what locale the log file should be written.</LI>
<LI><B>lrmUserConfig.xml</B>: this file is specific to a usage model of the Resource Manager client and should be modified to conform to the system on which the Resource Manager client is installed. It contains the Resource Manager user name and password, which directory contains the source code, where to generate the reports, etc.</LI>
 
 
</UL>
 
</UL>
   
=== lrmUserConfig.xml ===
 
This file holds some basic settings used by this client resource manager installation. The following elements are:
 
<ul><li><b>user-name</b>: the Resource Manager user name. Actions are associated with one user, as many users can interact with the system. (See Adding a User below)</li>
 
<li><b>user-password</b>: the password for that user. (See Adding a User below)</li>
 
<li><b>error-log</b>: the location of the log file.</li>
 
<li><b>base-src-dir</b>: the location of top level directory under which all your sources are kept. It could be "/" or "C:" or something more precise, such as "/projects/src/" for instance.</li>
 
<li><b>base-report-path</b>: the directory where all reports are generated.</li>
 
<li><b>prep-kit-path</b>: the location where kits are created. These are the kits which will be sent to translation</li>
 
</UL>
 
   
   
=== Report Location ===
+
== Reports Location ==
The default report location is defined in the lrmUserConfig.xml (see below). However, each report can be generated in the different location using the -f flag. To get a translation status generated in c:\tmp for instance, use the -fC:\tmp parameter on the -eL10nstatus swith, as in:
+
The default report location is defined in the application.properties. However, each report can be generated in the different location using the -f flag. To get a translation status generated in /tmp for instance, use the -f /tmp parameter, as in:
<code>%LRM_CMD% -eL10nstatus <kit-project-name> <b>-fC:\tmp</b></code>
+
<code>$LRM_CMD --report --import-issues --project-name project_name <b>-f /tmp</b></code>
   
  +
== Resource Manager Project Creation Commands==
  +
<b>Note</b>: the following commands are based on an alias for <code>lrm</code> on Linux along those lines:
   
  +
alias lrm='java -jar /var/lib/jenkins/lingoport/lrm-server-3.1/lrm-cli.jar'
   
  +
A project must be created under a licensed group.
== Resource Manager Project Definition & Configuration ==
 
Your software project may be divvied up into modules and sub-components. You may want to have files sent in for translation in one kit for the entire application, or organized into many kits, for instance one per module. In order to prepare a kit, you must first configure how the kits will be created. This is the step where we create a kit root.
 
In the <b>Samples</b> directory, you will find examples of some configurations. Copy one such file from the <b>Samples</b> directory into the <b>KitDefinitions</b> directory and adjust the parameters in that file:
 
<ul>
 
<li> <b>kit-project-name</b>: this name will be used when creating a kit or reporting on issues or displaying results in the Dashboard.</li>
 
<li> <b>kit-desc</b>: this is a description of the kit configuration</li>
 
<li> <b>top-level-dir</b>: the lrmUserConfig.xml has an element related to this one, the <b>base-src-dir</b>, which indicates where on your system all the source files are located. <b>base-src-dir+top-level-dir</b> tells the ResourceManager where to look for resource files. If you keep all your source files under <b>base-src-dir=C:\myWorkSpace</b> and your <b>top-level-dir</b> is Acme\src, then files under C:\myWorkSpace\Acme\src will be examined by the Resource Manager.</li>
 
<li> <b>target-locales</b>: the list of locales for translation. For instance, if the resource files need to be translated into Japanese and French, the list of target locales would include <code>jp_JA</code> and <code>fr_FR</code>.</li>
 
<li> <b>default-locale</b>: resources, text, typically defaults to a locale if the resource is not found.</li>
 
<li> <b>resource-extension</b>: what type of resources will be checked for validating, creating, verifying kits.
 
<ul> <li> The <b>extension</b> can be properties, resx, rjs, rxml, rc, or po. </li>
 
<li> The <b>file-name-pattern</b> reflects how the locale is added to the file name. <b>l</b> is for language, <b>c</b> for country, and <b>v</b> is for variant. For instance, the file name pattern <code>*_l_c</code> indicates you expect a file sent as <b>resources.properties</b> to be translated in French to <b>resources_fr_FR.properties</b>. </li>
 
<li> The <b>user-pattern-on-dflt-locale</b> set to "1" indicates you will use source files such as <b>resources_en_US.properties</b> to be sent for transation. If set to "0", you expect files such as <b>resources.properties</b> to be sent for translation.</li>
 
<li> the <b>file-location-pattern</b> is used when directories (not file names) are suffixed based on a pattern. </li>
 
</ul>
 
<li> <b>dirset</b>: is an Ant like directive to include or exclude directories or files from the kit creation.
 
</ul>
 
   
  +
To create a project in LRM, edit a project definition file and run the LRM <code>--create-project</code> command.
To configure the kit with an updated file, typically in KitDefinitions, type the following command:
 
  +
In the <b>Samples</b> directory, you will find examples of some configurations. Copy one such file from the <b>Samples</b> directory and adjust the parameters. See an example of the Project Definition File below (Resource Manager Project Sample Definition). We recommend having a directory named <code>project_definitions</code> under Jenkins home directory (e.g. /var/lib/jenkins).
<code>%LRM_CMD% -ecreateconfig <kitdefinition>.xml</code>
 
   
At any point during the process, type for following to check the kit definition:
+
To configure the LRM project, type the following command:
<code>%LRM_CMD% -etestconfig <kit-project-name> </code>
+
<code>lrm --create-project --group-name group_name -f project_definition.xml</code>
It will create one file per locale under the <code>reports\kit-project-name</code> directory.
 
   
  +
At any point during the process, type for following to check the project definition:
To get a starting <kitdefinition>.xml file for an existing project in the server database, type:
 
<code>%LRM_CMD% -edownload <kit-project-name></code>
+
<code>lrm --report --project-inspect --group-name group_name --project-name project_name </code>
  +
It will create a report per locale and echo on the Console the locations of the reports.
This may come in handy when you want to modify an existing configuration. The resulting xml file is named <b>SetupKitRootConfig.xml</b> and is located under <b>reports\<kit-project-name></b>
 
  +
  +
To get a starting <project definition>.xml file for an existing project in the server database, type:
  +
<code>lrm --export-project --group-name group_name --project-name project_name</code>
  +
This may come in handy when you want to modify an existing configuration.
   
 
To update a configuration, download and modify the corresponding xml file and type:
 
To update a configuration, download and modify the corresponding xml file and type:
<code> %LRM_CMD% -eupdateconfig <kitdefinition>.xml</code>
+
<code> lrm --group-name group_name --update-project -f project_definition.xml</code>
   
To see what kits are configured in the Resource Manager at large, type:
+
To see what projects are configured in the Resource Manager, type:
<code>%LRM_CMD% -ekitnames</code>
+
<code>lrm --group-name group_name --list-projects</code>
   
  +
== Resource Manager Project Definition ==
Once a kit root is configured, kits can be handled by the Resource Manager commands. Most of the daily work with resource files can start now.
 
  +
=== Sample File ===
 
== Resource Manager Project Sample Definition ==
 
 
The following project definition gives shows how a Java project is defined for properties files under the 'src' directories but not the 'test' directories, two target locales (French for France and German in Germany):
 
The following project definition gives shows how a Java project is defined for properties files under the 'src' directories but not the 'test' directories, two target locales (French for France and German in Germany):
 
<pre>
 
<pre>
<code>
 
<?xml version="1.0" encoding="UTF-8"?>
 
<lrmconf>
 
<model-version>1.0.0</model-version>
 
<kit-project-name>ResourceManagerAcmeProject</kit-project-name>
 
<kit-desc>This Acme application configuration handles the French for France (fr_FR) and the German for Germany (de_DE) locales for .properties and .resx files under the Acme src directory, to the exclusion of the test directory.</kit-desc>
 
<top-level-dir>Acme/src</top-level-dir>
 
<target-locales>
 
<locale>fr_FR</locale>
 
<locale>de_DE</locale>
 
</target-locales>
 
<default-locale>en_US</default-locale>
 
<resources-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></file-location-pattern>
 
</resource-extension>
 
</resources-extensions>
 
<dirset>
 
<include>
 
<include-dir>**/src/**</include-dir>
 
</include>
 
<exclude>
 
<exclude-dir>**/test/**</exclude-dir>
 
</exclude>
 
</dirset>
 
</lrmconf>
 
   
  +
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
</code>
 
  +
<lrmprojectdefinition>
  +
<model-version>3.1.14</model-version>
  +
<project-name>SampleLRM</project-name>
  +
<project-desc>Lingoport SampleLRM Project fr_FR and de_DE Java properties files</project-desc>
  +
<group-name>Lingoport</group-name>
  +
<top-level-dir>/var/lib/jenkins/jobs/Lingoport.SampleLRM/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>
  +
<track-back-locale>br</track-back-locale>
  +
<pseudo-locale/>
  +
<target-locales>
  +
<locale>fr_FR</locale>
  +
<locale>de_DE</locale>
  +
</target-locales>
  +
<default-locale>en_US</default-locale>
  +
<resource-extensions>
  +
<resource-extension>
  +
<extension>properties</extension>
  +
<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-extensions>
  +
<dirset>
  +
<includes>
  +
<include-dir-file>**/**</include-dir-file>
  +
</includes>
  +
<excludes>
  +
<exclude-dir-file>**/src/test/**</exclude-dir-file>
  +
<exclude-dir-file>**/bin/**</exclude-dir-file>
  +
<exclude-dir-file>**/target/**</exclude-dir-file>
  +
<exclude-dir-file>**/catalina.properties</exclude-dir-file>
  +
<exclude-dir-file>**/quartz.properties</exclude-dir-file>
  +
</excludes>
  +
</dirset>
  +
</lrmprojectdefinition>
  +
 
</pre>
 
</pre>
  +
  +
=== Explanation ===
  +
This section explains the XML elements of the Project Definition File.
  +
  +
<ul>
  +
<li> <b>group-name</b>: A project get created in a licensed group. A full name will be <code>group-name.project-name</code>.</li>
  +
<li> <b>project-name</b>: A project get created in a licensed group. A full name will be <code>group-name.project-name</code>.</li>
  +
<li> <b>project-desc</b>: this is free text for the project description</li>
  +
  +
<li> <b>top-level-dir</b>: the files to analyze are located under the repository local top level directory</li>
  +
<li> <b>target-locales</b>: the list of locales for translation. For instance, if the resource files need to be translated into Japanese and French, the list of target locales would include:
  +
<UL>
  +
<li> <code><target-locale>fr_FR</target-locale</code></li>
  +
<li> <code><target-locale>jp_JA</target-locale</code></li>
  +
</UL>
  +
<li> <b>default-locale</b>: the locale of the files to be translated</li>
  +
<li> <b>resource-extensions</b>: The list of resource extension types to support for this project</li>
  +
<li> <b>resource-extension</b>: one of the extension type to handle in this project
  +
<ul> <li> <b>extension</b> one of the supported resource file type, such as properties or resx. </li>
  +
<li> <b>file-name-pattern</b> how the locale is added to the file name if the file name reflects the locale. It may not, in which case this element is empty
  +
<ul>
  +
<li> <b>l</b> is for language</li>
  +
<li> <b>c</b> is for country</li>
  +
<li> <b>v</b> is for variant. </li>
  +
</ul>
  +
For instance, the file name pattern <code>*_l_c</code> indicates you expect a file sent as <b>resources.properties</b> to be translated in French to <b>resources_fr_FR.properties</b>. </li>
  +
<li> <b>use-pattern-on-dflt-locale</b> set to "1" indicates you will use source files such as
  +
<b>resources_en_US.properties</b> to be sent for transation. If set to "0", you expect files such
  +
as <b>resources.properties</b> to be sent for translation.</li>
  +
  +
<li> <b>file-location-pattern</b> is used when directories (not file names) are suffixed based
  +
on a pattern. </li>
  +
<li> <b>use-location-pattern-on-dflt-locale</b> in case the directory where the files to be translated are located follows some locale naming convention.</li>
  +
<li> <b>base-file-encoding</b> the encoding of the files to translate</li>
  +
<li> <b>localized-file-encoding</b> the encoding of the translated files</li>
  +
<li> <b>parameter-regex-pattern</b> the regexp to determine if a pattern represents a parameter, such as <code>{parameterName}</code> in some frameworks. For more on this, click the [[Parameter Regexp | Parameter Regex]] page.</li>
  +
</ul>
  +
<li> <b>dirset</b>: is an Ant like directive to include or exclude directories or files from the kit creation.</li>
  +
</li>
  +
</ul>

Latest revision as of 15:22, 30 November 2021


Resource Manager Configuration

Two files are used to configure the Resource Manager client:

  • application.properties: it is set up during installation and should not be need to be modified. It indicates how to connect to the Resource Manager database and in what locale the log file should be written.


Reports Location

The default report location is defined in the application.properties. However, each report can be generated in the different location using the -f flag. To get a translation status generated in /tmp for instance, use the -f /tmp parameter, as in:

 $LRM_CMD --report --import-issues --project-name project_name -f /tmp

Resource Manager Project Creation Commands

Note: the following commands are based on an alias for lrm on Linux along those lines:

 alias lrm='java -jar /var/lib/jenkins/lingoport/lrm-server-3.1/lrm-cli.jar' 

A project must be created under a licensed group.

To create a project in LRM, edit a project definition file and run the LRM --create-project command. In the Samples directory, you will find examples of some configurations. Copy one such file from the Samples directory and adjust the parameters. See an example of the Project Definition File below (Resource Manager Project Sample Definition). We recommend having a directory named project_definitions under Jenkins home directory (e.g. /var/lib/jenkins).

To configure the LRM project, type the following command:

 lrm --create-project --group-name group_name -f project_definition.xml

At any point during the process, type for following to check the project definition:

 lrm --report --project-inspect --group-name group_name --project-name project_name 

It will create a report per locale and echo on the Console the locations of the reports.

To get a starting <project definition>.xml file for an existing project in the server database, type:

 lrm --export-project --group-name group_name --project-name project_name

This may come in handy when you want to modify an existing configuration.

To update a configuration, download and modify the corresponding xml file and type:

  lrm --group-name group_name --update-project -f project_definition.xml

To see what projects are configured in the Resource Manager, type:

 lrm --group-name group_name --list-projects

Resource Manager Project Definition

Sample File

The following project definition gives shows how a Java project is defined for properties files under the 'src' directories but not the 'test' directories, two target locales (French for France and German in Germany):


<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<lrmprojectdefinition>
  <model-version>3.1.14</model-version>
  <project-name>SampleLRM</project-name>
  <project-desc>Lingoport SampleLRM Project fr_FR and de_DE Java properties files</project-desc>
  <group-name>Lingoport</group-name>
  <top-level-dir>/var/lib/jenkins/jobs/Lingoport.SampleLRM/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>
  <track-back-locale>br</track-back-locale>
  <pseudo-locale/>
  <target-locales>
    <locale>fr_FR</locale>
    <locale>de_DE</locale>
  </target-locales>
  <default-locale>en_US</default-locale>
  <resource-extensions>
    <resource-extension>
      <extension>properties</extension>
      <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-extensions>
  <dirset>
    <includes>
      <include-dir-file>**/**</include-dir-file>
    </includes>
    <excludes>
      <exclude-dir-file>**/src/test/**</exclude-dir-file>
      <exclude-dir-file>**/bin/**</exclude-dir-file>
      <exclude-dir-file>**/target/**</exclude-dir-file>
      <exclude-dir-file>**/catalina.properties</exclude-dir-file>
      <exclude-dir-file>**/quartz.properties</exclude-dir-file>
    </excludes>
  </dirset>
</lrmprojectdefinition>

Explanation

This section explains the XML elements of the Project Definition File.

  • group-name: A project get created in a licensed group. A full name will be group-name.project-name.
  • project-name: A project get created in a licensed group. A full name will be group-name.project-name.
  • project-desc: this is free text for the project description
  • top-level-dir: the files to analyze are located under the repository local top level directory
  • target-locales: the list of locales for translation. For instance, if the resource files need to be translated into Japanese and French, the list of target locales would include:
    • <target-locale>fr_FR</target-locale
    • <target-locale>jp_JA</target-locale
  • default-locale: the locale of the files to be translated
  • resource-extensions: The list of resource extension types to support for this project
  • resource-extension: one of the extension type to handle in this project
    • extension one of the supported resource file type, such as properties or resx.
    • file-name-pattern how the locale is added to the file name if the file name reflects the locale. It may not, in which case this element is empty
      • l is for language
      • c is for country
      • v is for variant.
      For instance, the file name pattern *_l_c indicates you expect a file sent as resources.properties to be translated in French to resources_fr_FR.properties.
    • use-pattern-on-dflt-locale set to "1" indicates you will use source files such as resources_en_US.properties to be sent for transation. If set to "0", you expect files such as resources.properties to be sent for translation.
    • file-location-pattern is used when directories (not file names) are suffixed based on a pattern.
    • use-location-pattern-on-dflt-locale in case the directory where the files to be translated are located follows some locale naming convention.
    • base-file-encoding the encoding of the files to translate
    • localized-file-encoding the encoding of the translated files
    • parameter-regex-pattern the regexp to determine if a pattern represents a parameter, such as {parameterName} in some frameworks. For more on this, click the Parameter Regex page.
  • dirset: is an Ant like directive to include or exclude directories or files from the kit creation.