Syncing your resource files with the Lingohub CLI client
By using LingoHub you're providing your translators with a sophisticated editor for your resource files. Now they have the chance to edit these files presented in a human-readable format. This article covers how you can improve your localization workflow through syncing your resource files with our CLI client (command line interface client). LingoHub will ensure that they cannot break anything by accident and that they know how to encode characters correctly in ISO-8859-1.
Let us assume a very common case: you forgot to upload the latest version of your resource files currently in development (i.e. your translators were translating the old stuff), or you forgot to download the files from Lingohub and to push them to your repository. You released a new version of your software and 17 of your 18 localizations are not fully translated, although the translators finished their work. Now don't panic, lingohub has got your back.
How LingoHub can help you solve this problemHow to import/export the files at the right time as part of your build process? Well, one option is to use our github integration. Every push to your repository will automatically trigger a new resource file import. LingoHub will always be synced to your development branch. However, a lot of our users do not use Github. That's why we provide you with a second option, the "LingoHub CLI client".
PrerequisitesOur CLI client is written in Ruby. In order to install it, follow these steps:
- install Ruby (follow the instructions for your platform)
- run "gem install lingohub" in your terminal to install our CLI client
Getting started"lingohub help" will show you all available actions you can now perform with the CLI client. At first you have to give the client your credentials, to determine as which user the client will connect to lingohub. Please do this with "Lingohub login". Now please enter your email and password that you are using to log in to lingohub.com.
You can leave the password blank if you prefer to use the API Token for the connection. It can be found under your authentication settings:
Now you can use every client command on the projects where you have the appropriate permissions.
Pushing files to LingoHubWith "lingohub resource:up <file1> <file2> ... --locale <iso2_slug> --project <name>" you can now import the latest resource files into your lingohub project. The locale parameter is optional and only needed if it is not possible to determine the ISO2 code from the file name.
You can write a shell script for example that imports all your files to lingohub. This script can be run manually, on a timed basis or as commit hook of your SCM, so lingohub will always be up to date with your development branch.
Retrieving files from lingohubFor retrieval, you can use "resource:down --locale <iso2_slug> --all --directory <path> --project <name>" to download the newest files from lingohub.
We do this on a daily basis, just to feel great about knowing that our translators already translated phrases that we've pushed to development just the day before.
What else can you do with the LingoHub CLI client?
- list your projects
- create a new project
- rename a project
- manage your collaborators
- manage invitations