LRM Fixing Issues

From Lingoport Wiki
Revision as of 17:55, 11 September 2017 by Llawson (talk | contribs) (Why, when I create a project, do I get an error stating that no resource files were found (Error 500)?)
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

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.

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

If you are confident that the localized files have been translated and do not want to send them to the localization vendor then there is a workaround to by-pass the localization vendor and import the files directly into LRM. The prerequisite is that the first prep kit is successful and the base resource files have been copied into the locale-specific folders. For each supported locale:

  • Create an import folder on your hard drive. This folder will contain all your localized files for a particular locale.
  • Copy all the localized files from the source repository for a particular locale into this new import folder.
  • In order to import these localized files into LRM, each file must contain a valid LRM prep kit tag. During kit preparation (--prep-kit), LRM places a comment tag at the top of each resource file that indicates the LRM Project, Kit version and target locale. An example LRM tag is: MyProjectName_1_5.
    • Locate the prep kit folder for this particular locale.
    • The location of a prep kit tag is dependent on the resource extension.
      • properties, po - comment is on the first line. Example: #MyProjectName_1_5
      • resx, rxml - comment is after xml tag. Example: <!--MyProjectName_1_5-->
      • rc, rjs - comment is on the first line. Example: //MyProjectName_1_5
      • msg - comment is on the first line. Example: $MyProjectName_1_5
    • Open up a resource file and copy the LRM tag. You only need to copy one tag per resource extension.
    • Paste this LRM tag into each localized file in your import folder that has the same extension.
  • Run the --import-kit command where the file location is your import folder.
  • If there are localized files that have not been translated then the import will fail. This is an indication that a file needs to be sent to your translation vendor.
    • Create a new folder in your prep kit folder that will contain these files.
    • Copy the non-translated file from your prep kit folder to this new folder. It's important to copy the base resource file that is in the appropriate prep kit folder as it contains the valid prep kit tag.
    • Send these files off for translation
    • Once these files are returned, copy them over to your import folder and run the --import-kit command again. In order for an import to be successful, all localized files must be translated.
  • After a successful --import-kit run the project status report. (--report --project-status). This particular locale should be at 100% complete if there have been no base resource file changes since it was last prepped.

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. These base files have not changed since they were last prepped.

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 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's definitions xml file does not match. You should fix the encoding of the base resource file and run --prep-kit --dry-run again.
  • DUPLICATE_KEY - there is a duplicate string key in the base resource file. Remove the duplicate and run --prep-kit --dry-run 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 --dry-run again.

This report may also contain warnings. Unlike errors, a kit can be successfully prepared if the base resource files contains warnings. The possible warnings are:

  • EMPTY_VALUE - the string key in the base resource file is set to an empty string. This is just a warning and will not prevent you from creating and sending out a Kit