In the last article, we've discovered the basics of YAMLFish, the simple and easy translation management tool.
In this article, we'll learn how to integrate YAMLFish into our development processes and how to use it to have keys translated by a non-developer person, and get the keys back into our codebase thanks to branches !
Main locale ?
Usually, in software projects you have a "main" locale, this is the one features are developed in, the keys for this locale are usually handled by the tech/product people.
Then, you have secondary locales, which are handled by translators.
For this article we'll assume our main locale is en
🇬🇧 and our secondary locales are fr
🇫🇷 and es
🇪🇸
Automatically push keys to YAMLFish
For our en
🇬🇧 locale, our source of truth is the codebase.
So we want our en
keys to always be in sync.
We can easily accomplish that by automatically pushing en
keys to YAMLFish when building our app. This can be added to any CI/CD platform in a breeze.
Here's the example for Github Actions :
- name: Push translations to yamlfish
if: github.ref == 'refs/heads/master'
run: gem install yamlfish --pre && yamlfish push en
Now, we are sure that each time we push to master
, our keys are sent to YAMLFish.
Working on a new feature that needs translations
Let's start working on a new feature. We'll open a new branch and push our code to it.
This feature introduces new translation keys and change a few existing ones, we need to ask for the fr
and es
translations.
This is where we can use YAMLFish branches. After creating a branch on the yamlfish dashboard, we can push our updated translations to it using :
yamlfish push en --branch my-awesome-feature
Sending the branch for translation
We can then ask our translators to fill in the missing translations.
From the YAMLFish dashboard, they will be able to see translation keys specific to the branch, and update the value for their locale.
Fetching the new translations
Once the translators have finished filling the keys, we can now move forward.
The first thing we need to do is merge our branch, so that our CI/CD pipeline will run and push the new translations for our en
🇬🇧 locale.
Once they are pushed, we can go on the YAMLFish dashboard and merge our branch :
We only want to merge our secondary locales as our main locale has been updated already.
Once this is done, we can simply pull our new translations :
yamlfish pull fr
yamlfish pull es
This will update our fr.yml
and es.yml
files (in config/locales
by default) with the new translations.
We can now commit the changes, and deploy our new feature !
Conclusion
Thanks to YAMLFish we were easily able to have our new feature translated by non-dev people in a frictionless way, from the comfort of our CLI.
In the next article, we'll see how to manage cases when non-dev people want to update translations in the main locale.
Top comments (0)