Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

If you are not a developer but want to help translate Opencaching just head over to https://crowdin.com/project/opencaching and start translating to your language.

Development Workflow and Info

We use the Translation component of the Symfony Framework to translate strings in the application. Have a look at the Symfony Book for more details. A short introduction follows below.

...

Warning

Do not manually edit other languages than *.en.yml and do not add them to the git repository. They are managed by crowdin an will be overwritten.

Translate Strings in Twig Templates

We prefer 

Code Block
languagexml
linenumberstrue
{{ 'your_module.your_context.your_key' | trans }}

...

Code Block
languagexml
linenumberstrue
{% trans %}your_module.your_context.your_key{% endtrans %}

 


You have to specify the constants domain if you need to create keys dynamically e.g.

...

and add your keys manually to constants.en.yml because they can not be extracted automatically and would be removed from messages.en.yml on the next extraction.

Translate Strings in PHP Code

Just use the translator service e.g.

Code Block
languagephp
linenumberstrue
$this->get('translator')->trans('your_module.your_context.your_key')

Extract strings from Source and Templates

We use JMSTranslationBundle to extract strings from source and templates.

...

After this you have to edit messages.en.yml and add the english text to the key (the bundle tags the new keys with # FIXME to find them easily)

Copy Translations to and from Crowdin

Preparation

Make sure you have a file .crowdin.yaml in the htdocs directory and it contains the api key of the project. See crowdin-cli documentation for details.

Download translations

cd to /var/www/html/htdocs and run

Code Block
languagebash
crowdin-cli --identity=.crowdin.yaml download

Upload translation source

cd to /var/www/html/htdocs and run

...