Translate¶
Translate Robot Framework source files from one or many languages to different one.
Note
Required Robot Framework version: >=6.0
Enabling the formatter
Translate is not included in default formatters.
You can enable it by using --select and --extend-select options.
Example of Robot Framework markers translation:
The language can be configured using language parameter with the language code (default en - English):
Since the translation is from one or many languages to one, only one language can be configured.
Source language¶
Robocop will translate only markers that can be recognized. If your source file is written in a different language,
you need to configure Robocop to recognize a given language. See :ref:language_support for more details.
The following example configures Robocop to read English, Polish and German languages and translate Robot Framework
markers to Ukrainian:
BDD keywords¶
BDD keywords are not translated by default. Set translate_bdd parameter to True to enable it:
Example of BDD keywords translation:
Some language has more than one alternative to BDD keyword. For example, Polish can use "Kiedy" or "Gdy" when
translating "When" keyword. In this situation Robocop will choose the first one (sorted alphabetically). It can
be overwritten using <bdd_keyword>_alternative parameters:
Language headers¶
Robocop can add or replace existing language header in the files. For example, if you're translating a file
written in German to Swedish, the language header will change from language: de to language: se.
Translation to English will remove the language header since it's not necessary.
To do this configure add_language_header parameter to True:
will result in: