-
Notifications
You must be signed in to change notification settings - Fork 95
Translation for Skosmos 3
Translation of the Skosmos 3 user interface is handled using the following infrastructure:
- In the Skosmos PHP backend, translations are managed using Symfony Translation.
- In the frontend code, Vue i18n is used (WIP, see #1523)
- To manage the translations to different languages, we use the Lokalise platform.
The base/default language for all messages is English, so messages in the Skosmos codebase (e.g. Twig templates and Vue templates) are in English. Translations to all other languages are maintained using Lokalise.
In the Skosmos application code, translations are saved in JSON files under resource/translations
. The files are named messages.XX.json
, where XX is the BCP47 language code.
TBW. Use Lokalise.
TBW. Use Lokalise.
When the code changes, the translations need to keep up. The way to ensure this is to extract the messages from the codebase and synchronize the changes to Lokalise, then pull back the translations from Lokalise to the codebase.
bin/console translation:extract --dump-messages en
(should be shown in the list) or
bin/console debug:translation en
(should show it as missing)
bin/console translation:extract --force en --format json --prefix ""
bin/console translation:push lokalise --domains messages --locales en --force
bin/console translation:pull lokalise --domains messages --format json
Note! It is possible that a key-value pair removed in Lokalise does not get deleted from the local English (default) language file as a result of the pull
command. In that case the --force
option could be used to remove the key-value pair, but it would delete all the pairs where both the key and value are the same (e.g. 'Error': 'Error').
Therefore, it is better to manually remove from the local file any key-value pairs that have been removed in Lokalise. The issue is known and a solution will be sought later.
This command shows unused messages:
bin/console debug:translation en
However, currently it can only see messages used in Twig templates, not elsewhere in the code. So the "unused" status cannot be relied upon.
TBW: how to remove unneeded messages from the translation files and from Lokalise