This tool is intended to make translation of English Play! Framework message files to other languages (specifically Welsh), simpler.
It will extract English messages, and any existing Welsh translations into a csv file, for translation.
Once the translation file has been populated and returned, the tool can extract the Welsh key/value pairs into a messages.cy file.
The tool may then be used to cross-reference the latest English messages file against a previous messages, within a specified git commit, to ensure sychnonisation. It will apply comments against each line, to indicate:
- a new, untranslated English message
- an existing changed English message
- an existing unchanged English message, which already has a Welsh translation
sbt run
- Specify the git project you want to examine.
- Specify the commit reference of the last time the Welsh translations were updated. If there are no previous Welsh translations, just put master, instead.
- Click the button at the bottom, to create the csv file.
Key | English | Welsh | Comments |
---|---|---|---|
pages.form.field.description.transferor-income | Confirm your annual income | Cadarnhau eich incwm blynyddol | English message unchanged |
title.eligibility | Your relationship | No Welsh translation found | |
title.dateOfBirth | Your date of birth | No Welsh translation found | |
pages.form.field.last-name.error.error.maxLength | Use up to or no more than {0} letters. | Defnyddiwch hyd at, neu ddim mwy na {0} llythrennau. | English message unchanged |
pages.form.field.description.gender | Confirm your spouse or civil partner''s gender | Cadarnhau eich priod neu eich partner sifil 'yn rhyw | English message unchanged |
coc.end-reason.SYSTEM | Ended by HMRC | No Welsh translation found |
- Select Mode, to convert from csv to messages
- Select the input and output files. (NB: the application will overwrite files, without confirmation)
- Click the button at the bottom, to create the Welsh messages file.
- Create application, using Play i18n, with text in Messages file(s)
- Run Message to Csv conversion, to create a csv file, from the English Messages file.
- Convert the csv file to a spreadsheet, using your favourite spreasheet application. You may need to adjust column widths, to make the file more readable.
- Send spreadsheet to translators.
- Receive spreadsheet back, with translations populated.
- Using your favourite spreadsheet application, export the spreadsheet to csv, using TABs to separate fields.
- Extract the (Welsh) translations from the csv file, using Csv to Messages.
- In future, Run Message to Csv against the git commit ref, where the Welsh translations were last updated. If the newly created csv highlights any changes, this indicates that additional translations are required. I.e. the English file has changed since the specified git commit.
- Messages.en is the definitive hand-crafted list of messages in the project, so never auto generated.
- Messages.cy is a straight generation from a csv/spreadsheet file.
- This application uses some native code. To date, it has only been tested on Linux and Mac (thanks to Callum Cooper c33-cooper-hmrc). It should work with any Bash shell, but does not yet support Windoze (unless you have Cywin or Windows Bash shell installed).