Difference between revisions of "LRM Process Commands Reference"

From Lingoport Wiki
Jump to: navigation, search
(Kit Preparation)
(Custom Emails)
 
(26 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
== Introduction ==
 
== Introduction ==
LRM Process interacts with the LRM engine (lrm-cli.jar) and L10n Vendors. It is also responsible for sending out notification emails.
+
LRM Process interacts with the LRM engine (lrm-cli.jar) and L10n Vendors. It is also responsible for sending out notification emails. The LRM Process commands are called in the Lingoport Jenkins Jobs.
  +
 
Each command has an abbreviation. The long version of each command starts with two dashes, <code>--</code>. The short version of each command starts with one dash, <code>-</code>.
 
Each command has an abbreviation. The long version of each command starts with two dashes, <code>--</code>. The short version of each command starts with one dash, <code>-</code>.
   
Line 7: Line 8:
 
<pre>
 
<pre>
   
-cs,--check-send Command to send any pending prep
+
-cs,--check-send Command to send any pending prep kits to the active L10n vendor.
kits to the active L10n vendor.
 
-d,--debug Log4j Debug mode
 
 
-f <path> Location of file (-f C:/MyLocation)
 
or file name with path (-f C:/myfolder/myfile.xml)
 
-gn,--group-name <group> Specifies the group name.
 
 
-h,--help Displays Help.
 
 
-ik,--import-kit Import the translated kit.
 
Example: `lrmprocess-cli.jar -ik`
 
-ju,--jenkins-user <jenkinsuser> Specifies the Jenkin's User that
 
started the job. Default is
 
`Jenkins`.
 
-kv,--kit-version <version#> Specifies the kit version id when
 
importing a kit or when
 
activating/deactivating a kit.
 
-lc,--locale <locale(s)> List of locales for the prep kit
 
--override option.
 
-lk,--late-kits Email type option to indicate
 
that an email should be sent
 
listing all late prep kits.
 
-nc,--notify-changes Email type option to notify
 
project managers of resource
 
file changes.
 
-or,--override Create a prep kit regardless of
 
whether there are changes to the
 
base files.
 
-pk,--prep-kit Prep a kit. Example:
 
`lrmprocess-cli.jar -pk -pn
 
<projectname> -gn <groupname>`
 
-plr,--process-lqa-requests Process all pending LQA
 
requests. Example:
 
`lrmprocess-cli.jar -plr`
 
-pn,--project-name <project> Specifies the LRM project name.
 
   
  +
-d,--debug Log4j Debug mode
-rf,--resource-file <resource-file(s)> List of resource files for the
 
  +
prep kit --override option.
 
-se,--send-email Command to send an email. The
+
-f,--file <path> Location of file (-f C:/MyLocation) or file name with path (-f
type of email is indicated by
+
C:/myfolder/myfile.xml)
additional options. Example:
+
-gn,--group-name <group> Specifies the group name.
  +
`lrmprocess-cli.jar -se <email
 
type> -pn <projectname> -gn
+
-gr,--global-replace Replace text in files that correspond to projects associated with supplied
<groupname>`
+
application file or name. The text to replace was determined by LocalyzerQA.
  +
Example 1: -gr -f <application config file>
-slr,--save-lqa-requests Save all outstanding LQA
 
requests. Example:
+
Example 2: -gr -ap 'RebelOutfitters'
`lrmprocess-cli.jar -slr`
+
-h,--help Displays help
  +
-vcg,--version-control-get Email type option to notify of
 
version control issues when
+
-ik,--import-kit Import the translated kit.
retrieving source.
+
Example: `lrmprocess-cli.jar -ik `
  +
-im,--is-mt Exit code is 0 if the supplied project`s L10n Vendor is a machine translated
-vci,--version-control-import Email type option to notify of
 
version control issues when
+
vendor otherwise the exit code is 1.
committing changes.
+
Example: `lrmprocess-cli.jar --is-mt -pn <projectname> -gn <groupname> `
-vn,--version LRM Process Main Version
+
-ju,--jenkins-user <jenkinsuser> Specifies the Jenkin's User that started the job. Default is `Jenkins`.
  +
  +
-kv,--kit-version <version#> Specifies the kit version id when sending a prep kit
  +
  +
-lc,--locale <locale(s)> List of locales for the prep kit --override option.
  +
  +
-lk,--late-kits Email type option to indicate that an email should be sent listing all late
  +
prep kits.
  +
-nc,--notify-changes Email type option to notify project managers of resource file changes.
  +
  +
-or,--override Create a prep kit regardless of whether there are changes to the base files.
  +
  +
-pk,--prep-kit Prep a kit.
  +
Example: `lrmprocess-cli.jar -pk -pn <projectname> -gn <groupname>`
  +
-plr,--process-lqa-requests Process all pending LQA requests.
  +
Example: `lrmprocess-cli.jar -plr`
  +
-pn,--project-name <project> Specifies the LRM project name.
  +
  +
-ppr,--process-postedit-requests Process all pending Post Edit requests.
  +
Example: `lrmprocess-cli.jar -ppr`
  +
-rf,--resource-file <resource-file(s)> List of resource files for the prep kit --override option.
  +
  +
-se,--send-email Command to send an email. The type of email is indicated by additional
  +
options.
  +
Example: `lrmprocess-cli.jar -se <email type> -pn <projectname> -gn
  +
<groupname>`
  +
-slr,--save-lqa-requests Save all outstanding LQA requests.
  +
Example: `lrmprocess-cli.jar -slr`
  +
-spr,--save-postedit-requests Save all outstanding Post Edit requests.
  +
Example: `lrmprocess-cli.jar -spr`
  +
-subj,--subject <arg> The subject line of the email. Required to send custom email.
  +
  +
-vcg,--version-control-get Email type option to notify of version control issues when retrieving
  +
source.
  +
-vci,--version-control-import Email type option to notify of version control issues when committing
  +
changes.
  +
-vn,--version LRM Process Main Version
  +
  +
-vt,--velocity-template <arg> Email type option to indicate a custom email. Location of custom velocity
  +
template is required.
 
 
 
</pre>
 
</pre>
   
   
===Send out prep kits===
+
===--check-send (Upload pending prep kits)===
  +
The --check-send command is used to upload any prep kits that may not have been uploaded. This can occur if the connection to the L10n Vendor cannot be established. Once it is fixed, the --check-send command is called to upload the prep kits.
LRM Process calls the LRM engine's prep kit job, uploads the files to the appropriate L10n vendor and sends out notifications emails.
 
   
  +
Notification emails are sent to the appropriate recipients (see [[Project_Configuration_Files#config_email_recipients.xml|Email Recipients]])
java -jar lrmprocess-cli.jar
 
   
  +
This command is called during the Jenkins Check Send job (see [[LRM_Jenkins_Jobs#Infrastructure|Jenkin's CheckSend Job]])
With the '''--dry-run''' option running successfully, you're ready to prepare a Kit for translation. You do this by running the '''--prep-kit''' command with only the LRM project name.
 
   
  +
java -jar lrmprocess-cli.jar --check-send
lrm --prep-kit --project-name <project name>
 
   
  +
=== --import-kit (Import Kits returned by L10n Vendor)===
By default, the Kit is created under your 'prep_kit' folder,. Each time you prepare a Kit for your LRM project, LRM will create a folder named PREP_KIT_<version>,(<code><HOME>/Lingoport_Data/LRM/<group-name>/prep_kit/MyProject</code>), with all the latest settings associated with your LRM Project where <version> is the kit version number. For example, if you ran --prep-kit on your LRM Project named MyProject, the first Kit would be created in the folder (<code><HOME>/Lingoport_Data/LRM/<group-name>/prep_kit/MyProject/PREP_KIT_1</code>.
 
  +
The import kit command searches for any kits that have been returned by the L10nVendor and imports them into LRM (see [[Importing_Translated_Kits|Importing TranslatedKits]]).
   
  +
Notification emails are sent to the appropriate recipients (see [[Project_Configuration_Files#config_email_recipients.xml|Email Recipients]])
The PREP_KIT_<version> contains:
 
   
  +
This command is called for each vendor's Jenkins Import Kit job (see [[LRM_Jenkins_Jobs#Infrastructure_Tab_Jobs|Jenkin's Import Kit jobs]])
* A folder for each locale with a copy of each base resource file that has changed since the last time the kit was prepped. If the '''prep.kit.changes.only''' option is set in the '''config_lrm_info.properties''' file then the resource files will contain only the key/value pairs that have changed since the last time the kit was prepped;
 
* A '''BaseFileSearch<target locale>.xml''' file for each locale describing the base files for the kit;
 
* If LRM detected only warnings in your base resource files, then there will also be a '''BaseFileSearchWarnings<default locale>.xml''' file describing the warnings.
 
* However, if there are errors in the base resource files (rather than just warnings), the PREP_KIT_<version> folder will contain a '''BaseFileSearchErrors<default locale>.xml''' file and the kit will ''not be created''. You must correct all errors prior to preparing a kit.
 
   
  +
If there is no option for the location of the translated files (--file option), then each L10n Vendor staging area is searched for pending translated kits.
The PREP_KIT_<version> folder is what you send out for translation. The localization vendor will translate the resource files in each of the target locale folders.
 
   
  +
java -jar lrmprocess-cli.jar --import-kit
Important Note: It is required that the resource files in the target locale folders are translated and returned, maintaining all the other text in the resource files. This is because LRM places a comment tag at the top of each resource file that indicates the LRM Project, Kit version and target locale, which LRM needs during the Kit Import process. An example LRM tag is: MyProjectName_1_5
 
  +
  +
===--prep-kit (Send out prep kits)===
  +
LRM Process calls the LRM engine's prep kit job, uploads the files to the appropriate L10n vendor and sends out notifications emails.
  +
  +
Notification emails are sent to the appropriate recipients (see [[Project_Configuration_Files#config_email_recipients.xml|Email Recipients]])
  +
  +
This command is called during the Jenkins Prep Kit jobs (see [[LRM_Jenkins_Jobs#PrepKit|Jenkin's Prep Kit Jobs]]).
  +
  +
java -jar lrmprocess-cli.jar -pk -pn <project> -gn <group>
  +
  +
  +
During the prep kit command, the files are prepped and moved to the prep kit staging area in order to be uploaded to the appropriate L10n vendor. The notification emails are then sent out.
   
 
==== Override Prep Kit ====
 
==== Override Prep Kit ====
Line 93: Line 108:
 
Examples:
 
Examples:
 
* Create a prep kit for all base resource files
 
* Create a prep kit for all base resource files
java -jar lrm-cli.jar -pk --override -pn <project> -gn <group>
+
java -jar lrmprocess-cli.jar -pk --override -pn <project> -gn <group>
 
* Create a prep kit for specific locales
 
* Create a prep kit for specific locales
java -jar lrm-cli.jar -pk --override -pn <project> -gn <group> --locale fr,de,es_mx
+
java -jar lrmprocess-cli.jar -pk --override -pn <project> -gn <group> --locale fr,de,es_mx
 
* Create a prep kit for specific resource files
 
* Create a prep kit for specific resource files
java -jar lrm-cli.jar -pk -or -pn <project> -gn <group> --resource-file /var/lib/jenkins/myproject/resources/file1.properties,/var/lib/jenkins/myproject/resources/file2.properties
+
java -jar lrmprocess-cli.jar -pk -or -pn <project> -gn <group> --resource-file /var/lib/jenkins/myproject/resources/file1.properties,/var/lib/jenkins/myproject/resources/file2.properties
 
* Create a prep kit for a specific locale file
 
* Create a prep kit for a specific locale file
java -jar lrm-cli.jar -pk -or -pn <project> -gn <group> -lc fr -rf /var/lib/jenkins/myproject/resources/file3.properties
+
java -jar lrmprocess-cli.jar -pk -or -pn <project> -gn <group> -lc fr -rf /var/lib/jenkins/myproject/resources/file3.properties
  +
  +
=== Send Emails ===
  +
==== Version Control Error Emails ====
  +
Errors may occur, outside of Localyzer, when trying to pull or push to the remote repository. If an error is detected, then in your script you can call the send-email with one of the following email type options:
  +
*''--version-control-get'' - if the error occurred when pulling from the remote repository.
  +
**Sends email to the prep kit recipients for that project (see [[Project_Configuration_Files#config_email_recipients.xml|Email Recipients]])
  +
  +
java -jar lrmprocess-cli.jar --send-email --version-control-get -pn <project> -gn <group>
  +
*''--version-control-import'' - if the error occurred when pushing the import files into the remote repository
  +
**Sends email to the import kit recipients for that project (see [[Project_Configuration_Files#config_email_recipients.xml|Email Recipients]])
  +
  +
java -jar lrmprocess-cli.jar --send-email --version-control-import -pn <project> -gn <group>
  +
  +
==== Custom Emails ====
  +
You can create your own custom email by creating a custom velocity template (https://velocity.apache.org/engine/1.7/user-guide.html). This custom velocity template may have any of the following tokens:
  +
*'''$groupname''' - is a valid Localyzer group name
  +
*'''$projectname''' - is a valid Localyzer project name for the group
  +
*'''$prepkitversion''' - must be a number but doesn't need to be a valid prep kit version
  +
*'''$applicationname''' - can be any text. Does not need to be a valid application name
  +
*'''$locale''' - can be any text. Does not need to be a valid project locale
  +
  +
Example template where the name of the file is ''example.vm'' and it contains all of the available tokens.
  +
  +
<pre>
  +
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
  +
<html>
  +
<body>
  +
<p> This is for group $groupname</p>
  +
<p> This is for project $projectname </p>
  +
<p> This is for kit version $prepkitversion </p>
  +
<p> This is for application name $applicationname </p>
  +
<p> This is for locale $locale </p>
  +
</body>
  +
</html>
  +
</pre>
  +
  +
Command example for this template could be:
  +
  +
java -jar lrmprocess-cli.jar -se -vt /var/lib/jenkins/velocity/example.vm -gn <group> -pn <project> -subj "My Custom Example" -kv 121 -an "'I can put anything here'" -lc "'This can also be anything'"
  +
  +
'''Required arguments''' are the project name, group name, velocity file and subject.
  +
  +
The email will be sent to the import kit recipients for that project. (see [[Project_Configuration_Files#config_email_recipients.xml|Email Recipients]])
  +
  +
There is a more robust sample for a custom velocity template located in the ''samples'' folder of your Localyzer install directory.

Latest revision as of 18:24, 29 April 2022

Introduction

LRM Process interacts with the LRM engine (lrm-cli.jar) and L10n Vendors. It is also responsible for sending out notification emails. The LRM Process commands are called in the Lingoport Jenkins Jobs.

Each command has an abbreviation. The long version of each command starts with two dashes, --. The short version of each command starts with one dash, -.

Reference

This reference gives the short and the long version of each Resource Manager command and a usage example.


 -cs,--check-send                                     Command to send any pending prep kits to the active L10n vendor.

 -d,--debug                                           Log4j Debug mode

 -f,--file <path>                                     Location of file (-f C:/MyLocation) or file name with path (-f
                                                      C:/myfolder/myfile.xml)
 -gn,--group-name <group>                             Specifies the group name.

 -gr,--global-replace                                 Replace text in files that correspond to projects associated with supplied
                                                      application file or name. The text to replace was determined by LocalyzerQA.
                                                      Example 1: -gr -f <application config file>
                                                      Example 2: -gr -ap 'RebelOutfitters'
 -h,--help                                            Displays help

 -ik,--import-kit                                     Import the translated kit.
                                                      Example: `lrmprocess-cli.jar -ik `
 -im,--is-mt                                          Exit code is 0 if the supplied project`s L10n Vendor is a machine translated
                                                      vendor otherwise the exit code is 1.
                                                      Example: `lrmprocess-cli.jar --is-mt -pn <projectname> -gn <groupname> `
 -ju,--jenkins-user <jenkinsuser>                     Specifies the Jenkin's User that started the job. Default is `Jenkins`.

 -kv,--kit-version <version#>                         Specifies the kit version id when sending a prep kit

 -lc,--locale <locale(s)>                             List of locales for the prep kit --override option.

 -lk,--late-kits                                      Email type option to indicate that an email should be sent listing all late
                                                      prep kits.
 -nc,--notify-changes                                 Email type option to notify project managers of resource file changes.

 -or,--override                                       Create a prep kit regardless of whether there are changes to the base files.

 -pk,--prep-kit                                       Prep a kit.
                                                      Example: `lrmprocess-cli.jar -pk -pn <projectname> -gn <groupname>`
 -plr,--process-lqa-requests                          Process all pending LQA requests.
                                                      Example: `lrmprocess-cli.jar -plr`
 -pn,--project-name <project>                         Specifies the LRM project name.

 -ppr,--process-postedit-requests                     Process all pending Post Edit requests.
                                                      Example: `lrmprocess-cli.jar -ppr`
 -rf,--resource-file <resource-file(s)>               List of resource files for the prep kit --override option.

 -se,--send-email                                     Command to send an email. The type of email is indicated by additional
                                                      options.
                                                      Example: `lrmprocess-cli.jar -se <email type> -pn <projectname> -gn
                                                      <groupname>`
 -slr,--save-lqa-requests                             Save all outstanding LQA requests.
                                                      Example: `lrmprocess-cli.jar -slr`
 -spr,--save-postedit-requests                        Save all outstanding Post Edit requests.
                                                      Example: `lrmprocess-cli.jar -spr`
 -subj,--subject <arg>                                The subject line of the email. Required to send custom email.

 -vcg,--version-control-get                           Email type option to notify of version control issues when retrieving
                                                      source.
 -vci,--version-control-import                        Email type option to notify of version control issues when committing
                                                      changes.
 -vn,--version                                        LRM Process Main Version

 -vt,--velocity-template <arg>                        Email type option to indicate a custom email. Location of custom velocity
                                                      template is required.
                                    


--check-send (Upload pending prep kits)

The --check-send command is used to upload any prep kits that may not have been uploaded. This can occur if the connection to the L10n Vendor cannot be established. Once it is fixed, the --check-send command is called to upload the prep kits.

Notification emails are sent to the appropriate recipients (see Email Recipients)

This command is called during the Jenkins Check Send job (see Jenkin's CheckSend Job)

 java -jar lrmprocess-cli.jar --check-send

--import-kit (Import Kits returned by L10n Vendor)

The import kit command searches for any kits that have been returned by the L10nVendor and imports them into LRM (see Importing TranslatedKits).

Notification emails are sent to the appropriate recipients (see Email Recipients)

This command is called for each vendor's Jenkins Import Kit job (see Jenkin's Import Kit jobs)

If there is no option for the location of the translated files (--file option), then each L10n Vendor staging area is searched for pending translated kits.

  java -jar lrmprocess-cli.jar --import-kit

--prep-kit (Send out prep kits)

LRM Process calls the LRM engine's prep kit job, uploads the files to the appropriate L10n vendor and sends out notifications emails.

Notification emails are sent to the appropriate recipients (see Email Recipients)

This command is called during the Jenkins Prep Kit jobs (see Jenkin's Prep Kit Jobs).

 java -jar lrmprocess-cli.jar -pk -pn <project> -gn <group>


During the prep kit command, the files are prepped and moved to the prep kit staging area in order to be uploaded to the appropriate L10n vendor. The notification emails are then sent out.

Override Prep Kit

The override option of the prep kit command will prep a kit regardless of whether there are changes to the base resource files. The prep kit can be filtered by base resource files (--resource-file options) as well as locales (--locale option). If there are no additional options then all base resource file will be sent out for translation.

Examples:

  • Create a prep kit for all base resource files
   java -jar lrmprocess-cli.jar -pk --override -pn <project> -gn <group>
  • Create a prep kit for specific locales
   java -jar lrmprocess-cli.jar -pk --override -pn <project> -gn <group> --locale fr,de,es_mx
  • Create a prep kit for specific resource files
   java -jar lrmprocess-cli.jar -pk -or -pn <project> -gn <group> --resource-file /var/lib/jenkins/myproject/resources/file1.properties,/var/lib/jenkins/myproject/resources/file2.properties
  • Create a prep kit for a specific locale file
   java -jar lrmprocess-cli.jar -pk -or -pn <project> -gn <group> -lc fr -rf /var/lib/jenkins/myproject/resources/file3.properties

Send Emails

Version Control Error Emails

Errors may occur, outside of Localyzer, when trying to pull or push to the remote repository. If an error is detected, then in your script you can call the send-email with one of the following email type options:

  • --version-control-get - if the error occurred when pulling from the remote repository.
 java -jar lrmprocess-cli.jar --send-email --version-control-get -pn <project> -gn <group>
  • --version-control-import - if the error occurred when pushing the import files into the remote repository
    • Sends email to the import kit recipients for that project (see Email Recipients)
 java -jar lrmprocess-cli.jar --send-email --version-control-import -pn <project> -gn <group>

Custom Emails

You can create your own custom email by creating a custom velocity template (https://velocity.apache.org/engine/1.7/user-guide.html). This custom velocity template may have any of the following tokens:

  • $groupname - is a valid Localyzer group name
  • $projectname - is a valid Localyzer project name for the group
  • $prepkitversion - must be a number but doesn't need to be a valid prep kit version
  • $applicationname - can be any text. Does not need to be a valid application name
  • $locale - can be any text. Does not need to be a valid project locale

Example template where the name of the file is example.vm and it contains all of the available tokens.

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
    <body>
        <p> This is for group  $groupname</p>
        <p> This is for project $projectname </p>
        <p> This is for kit version $prepkitversion </p>
        <p> This is for application name $applicationname </p>        
        <p> This is for locale $locale </p>
    </body>
</html>

Command example for this template could be:

 java -jar lrmprocess-cli.jar -se -vt /var/lib/jenkins/velocity/example.vm -gn <group> -pn <project> -subj "My Custom Example" -kv 121 -an "'I can put anything here'"  -lc "'This can also be anything'"

Required arguments are the project name, group name, velocity file and subject.

The email will be sent to the import kit recipients for that project. (see Email Recipients)

There is a more robust sample for a custom velocity template located in the samples folder of your Localyzer install directory.