LRM Fixing Issues

From Lingoport Wiki
Revision as of 18:16, 11 September 2017 by Llawson (talk | contribs) (I know that most of my localized files have been translated before using LRM. How can I get my resource files into the LRM system without relying on the localization vendor's translation memory)
Jump to: navigation, search

Create/Update LRM Project

How can I tell if my LRM project is setup correctly?

Once you've created your LRM project run the project inspect report;

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

What extensions are supported by LRM?

See Supported Resource Bundles for an up to date list of supported resource file types.

How do I fix "Error 202 - extension not supported" when updating or creating my project?

  • Verify that the project definition xml contains a supported extension. A valid extension does not include a period. For example, if the extension is for ".properties" files then the xml value should be:
<extension>properties</extension>

not

 
<extension>.properties</extension>

How do I fix "Error 215 - incorrect pattern for extension" when updating or creating my project?

There are two supported patterns, LCID or language/country/variant.

  • For LCID - no other alpha characters are allowed except for LCID. For example, you could have a file name pattern "*_LCID" which, in the case of an fr_FR target locale, would result in "myResources_1036.po" as the filename of the translated resource file.
<file-name-pattern>*_LCID</file-name-pattern>
  • For language/country/variant - no other alpha characters are allowed except for l (language), c (country) and v (variant). The variant must be present even if you are not using variants. The order of the characters must be language, country, variant. For example, the file name pattern "*_l_c_v" applied to a base "po" resource file "myResources.po" would result in LRM naming the French in France translated file "myResources_fr_FR.po" before inserting it into the source code tree.
<file-name-pattern>*_l_c_v</file-name-pattern>

How do I fix "Error 218 - invalid base file encoding" and "Error 219 - invalid localized file encoding" when updating or creating my project?

The supported encodings vary between different implementations of the java platform. For example, the list of supported encodings supported by Java SE 8 is found here http://docs.oracle.com/javase/8/docs/technotes/guides/intl/encoding.doc.html. The encoding that should be copied into the project definition xml is located under column "Canonical Name for java.nio API". Every implementation of Java is required to support the following encodings.

  • US-ASCII
  • ISO-8859-1
  • UTF-8
  • UTF-16BE
  • UTF-16LE
  • UTF-16

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

It sounds as if your project is not setup correctly. Check the project definition file used to create the project. Configuration settings to check are:

  • <top-level-dir> - this is the path to the source code (resource files) for the LRM Project.
<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> - 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> - Set to "1", 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", 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 for "myResources.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> - verify that the separator characters are correct.
  • <include-dir>...</include-dir> - 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> - 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>

Prep Kit

When we generate the first prep kit with LRM, will all the base locale resource files be extracted, or only those base locale resource files that have corresponding localized files that have not been translated?

For the first prep kit, only those base locale resource files that have corresponding localized files that have not been translated are sent out for translation. This includes missing keys or missing files.

Note-After the first prep kit, LRM is able to detect modified text as well as missing keys and missing files. It's always a good idea that the prep kit command is executed after creating a project in order for the files to get into the system in order to monitor text changes.

For example let's say you have a project with:

  • 3 locales: en_US (base locale), fr_FR and de_DE.
  • 2 base files
    • file1_en_US.properties (100 keys)
    • file2_en_US.properties
  • 1 fr_FR file with a missing key
    • file1_fr_FR.properties (99 keys)
  • 1 de_DE with 2 missing keys
    • file1_de_DE.properties (98 keys)


Create a prep kit for the new LRM project

> java -jar lrm-cli.jar -pk -pn ProjectName -gn GroupName
The following reports were generated:
/var/lib/jenkins/Lingoport_Data/LRM/GroupName/prep_kit/ProjectName/PREP_KIT_1/BaseFileSearch_de_de.xml
/var/lib/jenkins/Lingoport_Data/LRM/GroupName/prep_kit/ProjectName/PREP_KIT_1/BaseFileSearch_fr_fr.xml
/var/lib/jenkins/Lingoport_Data/LRM/GroupName/prep_kit/ProjectName/PREP_KIT_1/FilesToPrep.xml
/var/lib/jenkins/Lingoport_Data/LRM/GroupName/prep_kit/ProjectName/PREP_KIT_1/ProjectName_1_de_de.xml
/var/lib/jenkins/Lingoport_Data/LRM/GroupName/prep_kit/ProjectName/PREP_KIT_1/ProjectName_1_fr_fr.xml
Process completed successfully.

The base locale resource files are extracted and place in the appropriate localized prep kit folders. See the de_de and fr_fr folders.

> ls /var/lib/jenkins/Lingoport_Data/LRM/GroupName/prep_kit/ProjectName/PREP_KIT_1/
BaseFileSearch_de_de.xml  FilesToPrep.xml      ProjectName_1_fr_fr.xml
BaseFileSearch_fr_fr.xml  fr_fr/
de_de/                     ProjectName_1_de_de.xml

In the fr_fr folder, are all the files to be translated:

> ls /var/lib/jenkins/Lingoport_Data/LRM/GroupName/prep_kit/ProjectName/PREP_KIT_1/fr_fr/
file1_en_US.properties           
file2_en_US.properties

For missing files, the entire file will be sent. For missing keys (or modified text) only the changed keys will be sent.

How can I prevent a file or folder from being included in the prep kit?

You will need to alter your project definition file and exclude the file/folder from the project.

  • Export your project (--export-project -pn YourProjectName). This command exports your LRM project configuration to a file named ProjectDefinition.xml in your reports folder.
> java -jar lrm-cli.jar --export-project -pn YourProjectName -gn GroupName
The following report was generated:
/var/lib/jenkins/Lingoport_Data/LRM/GroupName/reports/YourProjectName/ProjectDefinition.xml
Process completed successfully.
  • Add an <exclude-dir-file> tag to the ProjectDefinition.xml file that contains either the file or folder name using the proper Ant formatting directive.
   <excludes>
      <exclude-dir-file>**/This_directory/**</exclude-dir-file>
      <exclude-dir-file>**/Another_directory/**</exclude-dir-file>
      <exclude-dir-file>**/a_file</exclude-dir-file>
    </excludes>
  • Update the project with the changes you made to the ProjectDefinition file
> java -jar lrm-cli.jar --update-project -f /var/lib/jenkins/Lingoport_Data/LRM/GroupName/reports/YourProjectName/ProjectDefinition.xml
  • Run the project inspect report to verify that the file or folder was excluded from the search.
> java -jar lrm-cli.jar -r --project-inspect -pn YourProjectName -gn GroupName

Why, when I prep a kit, do I get a report called "OutstandingPrepFiles<target locale>.xml"?

The base files that are listed in this report are files that have been prepped in an earlier kit and have not been imported. LRM keeps track of the changes for each prep kit. In this way, the same base file can be outstanding for multiple prep kits.

Why, when I prep a kit, do I get a report called "DuplicatePrepFiles<target locale>.xml"?

This is the list of duplicate base file names. A LRM prep kit must contain unique file names as all the files are located in the same folder. The existence of a "DuplicatePrepFiles<target locale>.xml report indicates that at least one more kit will need to be prepared after the current kit has successfully been prepped.

Why, when I prep a kit, do I get a report called "BaseFileSearchErrors<default locale>.xml"?

This report lists all the critical errors in the base resource files that were found during the preparation of the kit. All errors must be resolved before a kit can be prepared. The possible errors are:

  • ENCODING - the base-file-encoding you set in your LRM Project definition xml file does not match. You should fix the encoding of the base resource file and run --prep-kit again.
  • DUPLICATE_KEY - there is a duplicate string key in the base resource file. Remove the duplicate and run --prep-kit again.
  • EMPTY_KEY - the value has no corresponding key. Either remove the value from the file or add the appropriate key.
  • FILE_TOO_BIG - a base resource file cannot be larger than 16 megabytes. You will need to break up your resource file into multiple files and then run --prep-kit again.
  • UNKNOWN_FILE_FORMAT - the base resource file could not be parser. You will need to fix the format and the run --prep-kit again.