We at Public Lab are improving our Translation and Internationalization workflow. Our website is a Ruby on Rails app and we use SimpleBackend for keeping our translations i.e., only depend on YAML files.
For a long time, we are keeping our YAML files in different directories and subdirectories as you can see here - https://github.com/publiclab/plots2/tree/master/config/locales. We already have a Transifex account - https://www.transifex.com/publiclab/publiclaborg/ which contains nearly same number of files divided into categories.
Now, we want to move to single YAML file per language-based approach and want some help from Transifex community and developers in guiding us for the same.
We can merge the YAML files using a script, but we are more bothered about our data at Transifex, how can we manage that? Suppose, we download only reviewed YAML files and combine them into a single file then the translated strings which haven’t been reviewed yet would be lost?
Any help/advice regarding our approach and thought-process would be appreciated.
Regarding your case, in order to achieve what you want, you can use one of the following ways:
#1: Download only reviewed translations
Make sure that before proceeding the setting “Translation Memory Fill-up” is disabled under your project’s settings page.
Download and merge all source and translation files so that you will have a single file for each language. The translation files should be exported from Transifex using the mode “Download only reviewed translations”. In case of YML (v=2), any unreviewed or untranslated string is not included in the generated file when this mode is selected.
Create the new resource using the newly created files
Enter the editor find the strings that appear as translated, select them all and mark them as reviewed
Finally, visit your project’s settings page and enable the option “Translation Memory Fill-up”. After that, Translation Memory will be triggered and translate the rest of the strings under the new resource relying on previously submitted translations. More information about this feature can be found in our documentation guide here.
#2: API - Strings’ statuses
You can use the API and get a list of all the translations that have already been reviewed.
Download and merge all source and translation files so that you will have a single file for each language. Use the Download mode “Download for translation” in order to export the translation files from Transifex, merge them and re-upload them under the new resource.
Create the new resource using the newly created files (keep the rest of the resources until you get the list of all the reviewed strings)
Use the following API endpoint for every target language of your project for the resources you are interested in.
In the response, you will get all the translations for a specific language along with their review statuses as you can see below:
More information about this API endpoint can be found here [Uploading and downloading a collection of translation strings].
So, via a script you need to:
– run the above API endpoint for each target language and then filter the entries by “reviewed: true”. That way you can have all the reviewed entries per target language along with their uniquely defined hashes.
– Finally, using the same API endpoint (this time the resource_slug should refer to the newly created resource), update the status of these strings by marking them as reviewed via API calls.
Does the above help?
Thanks for replying and specifying methods in detail.
Both the methods specified by you resembles our current approach of merging and then uploading files again so we are more confident in our approach now. As we have less number of reviewed string so we decided to go with Translated one’s and will handle review string after that.