Use the CLI client to synchronize translations from within a CI environment.
To download strings into a CI environment, follow these steps:
-
Create a
.phrase.yml
configuration file. -
Add a new bash script or step to the CI.
-
To upload new strings, add this command to script:
#!/bin/bash # upload new strings to Phrase as configured in the .phrase.yml phrase push
Ensure
update_translation
orupdate_description
parameters are set if intending to not only add new values but also update existing values. -
To download translated strings into the current workspace, add this command:
#!/bin/bash # get new strings from phrase as configured in the .phrase.yml phrase pull
Ensure the correct keys are included by using tags, as well as required options for verified and translated entries.
-
Register a webhook to subscribe to the required events.
Webhooks are available for major events (e.g., a processed upload or completed order). A common workflow is to set up a notification for newly created comments in a Slack channel, as well as import scripts for job completions.
API can also be used to query the current state of these items as well, depending on update cycles.
-
Branches
Phrase Strings has a branching concept for versioning that differs from typical applications of Git branches. Phrase branches can be used alongside Git branches. Check in the branch name in the configuration file for that branch and run CI steps in it.
When adding features, translations are usually added without removing existing ones. Add tags to the working branches and upload them to the main branch to allow tracking of features with share keys but also pulls and tests on certain subsets without confusing translators.