Lingobot CLI (Command Line Interface) is an extension of Lingobot that allows similar commands to be processed without the use of a collaboration utility like Slack or Flowdock. The commands can be run directly from a command line, or can be launched with user-friendly prompts from an IDE (integrated development environment) like Eclipse. In either case, they allow developers direct access to some of the many powerful Lingoport i18n features.
Checking the Configuration
Lingobot CLI is installed and configured when the Lingobot is installed. If the lingobot service is not running on the globalization server, then the Lingobot CLI cannot be used. To check if the service is running, run the following as a user with root access:
sudo systemctl status lingoport-lingobot.service
It should return with text that says:
active (running). If that is not visible, or it does not say "active (running)" then return to the Lingobot Installation Page before continuing.
Before running the first time, check the
app.properties file. It is created when the lingobot service is installed.
> cd /var/lib/jenkins/lingoport/lingobot-cli-<x.y.z> > cat app.properties lingobot_domain=http://acme.company.com lingobot_port=5001 lingobot_api_token=OGJmMzNmMDRjYTE3NDhmYTk4ODViYzBjMTQ5
lingobot_domainshould be the URL of the Lingoport Dashboard.
lingobot_portis the port. This was set in the install configuration script. 5001 is the default port.
lingobot_api_tokenis a token created during the installation. This will probably never change.
Verifying the functionality
If the Lingobot service is running, from the globalization server, one can verify the lingobot-cli functionality.
> cd /var/lib/jenkins/lingoport/lingobot-cli-<x.y.z> > java -jar lingobot-cli.jar version x.y.z
Test that lingobot-cli can communicate with Jenkins and the Dashboard. The "list projects" command should show all the Jenkins jobs under the Automation tab.
> java -jar lingobot-cli.jar "list projects" List of all active projects: ``` Name | Type -------------------------------------------------|-----------------|-------- ACME.LiteProject | Gyzr Lite | Parent ACME.LRMProject | LRM | Parent ACME.LRMProject2 | LRM | Parent ACME.LRMProject2--branch | LRM | Child ACME.LRMLiteProject | LRM / Gyzr Lite | Parent ```
View the help and see the examples given.
> java -jar lingobot-cli.jar help Lingobot CLI Help Parameter 1: command (help, pseudoloc, etc) -prompt : prompt for parameters (-prompt, -p) -directory : working directory (-directory, -d, -dir) Commands: delete project <group>.<project>:<branch> duplicate project [-force ] <group>.<project>:<branch> i18n scan <group>.<project>:<branch> list projects [<query>] pseudoloc <group>.<project>:<branch> show dashboard [<group>.<project>[:<branch>]] show errors <group>.<project>[:<branch>] status translate <group>.<project>:<branch> translation status <group>.<project>[:<branch>] update dashboard <group>.<project>[:<branch>] version Examples: "delete project" MYGROUP.MyProject:myBranch "delete project" -prompt "delete project" -prompt -dir c:\myProject\Location "duplicate project" -force MYGROUP.MyProject:myNewBranch "duplicate project" -prompt "duplicate project" -prompt -dir c:\myProject\Location "i18n scan" MYGROUP.MyProject:myBranch "list projects" "list projects" -prompt "list projects" LRM pseudoloc -prompt pseudoloc -prompt -dir c:\myProject\Location pseudoloc MYGROUP.MyProject:myBranch "show dashboard" MYGROUP.MyProject:myBranch "show dashboard" MYGROUP.MyProject "show dashboard" -prompt -dir c:\myProject\Location "show errors" MYGROUP.MyProject:myBranch "show errors" MYGROUP.MyProject "show errors" -prompt -dir c:\myProject\Location translate MYGROUP.MyProject:myBranch translate -prompt -dir c:\myProject\Location "translation status" MYGROUP.MyProject:myBranch "translation status" MYGROUP.MyProject "translation status" -prompt -dir c:\myProject\Location "update dashboard" MYGROUP.MyProject:myBranch "update dashboard" MYGROUP.MyProject "update dashboard" -prompt -dir c:\myProject\Location status
Once Lingobot and the Lingbot service has been set up, there are only a few additional settings needed that can be modified for Lingobot CLI. These can be found within the lingobot_config.sh (
/var/lib/jenkins/lingoport/lingobot-<x.y>/config/lingobot_config.sh) file in the Lingobot installation. The settings are listed below:
# OPTIONAL CONFIGS FOR LINGOBOT API export LINGOBOT_API_STATUS_INTERVAL_SECONDS_ARRAY=0,10,20,30 # example: 15,30,60,150,300 (note: the last interval will continue to be used until the timeout is reached export LINGOBOT_API_STATUS_TIMEOUT_MINUTES=0 # identifies how long a JVM request will wait for a response. example: 60 LINGOBOT_API_STATUS_MINUTES_TO_KEEP_MAXIMUM = # identifies the maximum number of minutes a response message will be retained on the server
If the Lingobot CLI settings need to be changed after the lingobot service has been started, stop the service, make the changes and restart the service.
> sudo systemctl stop lingoport-lingobot.service > <make changes to lingobot_config.sh file> > sudo systemctl start lingoport-lingobot.service
If your Lingobot service has been started successfully, then this value will be populated. Leave it alone and move to the next variable. This value must be set to a unique value, preferably a 36-character GUID such as can be created here https://www.guidgenerator.com/. The value set here will also be used in the Client Install Preparation below.
This value is copied into the
app.properties file that is in the
lingobot-cli-<x.y.z> directory and in the zip file created for clients.
When a Lingobot command has been processed, but the server is unable to respond immediately, this comma-delimited grouping of numbers identifies how many seconds until the client next checks the status. If the variable is not set, the default is "15,30,60,60,60,180,300", meaning the client will check for the command completion after 15 seconds, then 30 seconds, then 60 seconds, etc. The final number in the list will continue to be used indefinitely until a timeout is reached.
If the first digit is 0, it will check the timeout value immediately. If you don't wish the system to check the status, set the first value to zero.
This value defaults to 2 minutes if it is not set, and identifies how long JVM clients will continue to check with the server for completion before a timeout is reached. Since a single JVM may use 50mb or more of memory, keeping this value low helps manage memory on client machines, particularly when multiple commands may be issued in a short period of time. If it is set to zero, then the command will timeout immediately, giving back the command line to run other commands.
This value identifies the maximum number of minutes the server will remember the result of any particular command. The value default to 500; however, the retrieval and distribution to the client of a command result also eliminates the tracking of that command. Thus, it is rare that any particular command will be tracked this long.
export LINGOBOT_API_STATUS_MINUTES_TO_KEEP_MAXIMUM =
Client Install Preparation
The Lingobot installation creates a zip file in the
/var/lib/jenkins/lingoport directory containing the files needed to run Lingobot CLI from a client machine, and integrate the calls into the Eclipse, IntelliJ and Visual Studio IDEs. The zip file contains an app.properties file that should be populated with the correct information, which are the same values as the file on the globalization server. If the server has been installed with the Stack Installer and configured, these values should have been automatically filled in correctly.
In addition to the app.properties settings mentioned above, it may be helpful to update the README.md file with any custom information that may be helpful to developers.
Client Install Distribution
It's recommended that Lingoport customers re-zip the client install and make it available to their own developers as desired. This is often done through the System Administrator, and may involved distributing the necessary file through the company's own website or software distribution portal.