Repository navigation
Description
Currently we can only use English with section headers, settings, and other such markers in the data. For example:
*** Settings ***
Documentation Some doc here.
Supporting other languages would be great. For example, the above could look like this in Finnish:
*** Asetukset ***
Dokumentaatio Jotain dokua täällä.
Getting this done requires:
- Deciding how to enable support for different languages. Probably with a command line option like
--language FI. - Deciding how to handle multiple languages in one execution. Could be
--language FI --language ENto allow customizing how a certain language is used e.g. like--language FI:some:config. - Deciding what to translate. Section headers and settings for sure, but what about control structures like IF/ELSE? Perhaps we should allow translating everything and let translators to select do they want to use common IF/ELSE or some local variant. Could also be customizable when enabling support for a certain language.
- Getting translations for built-in support for common languages. These can be added in future releases.
- Deciding how to use languages that don't have built-in support. Perhaps
--language mylang.txt.
I hope the wider community can help with translations when we get that far. Comments about the design decisions above are appreciated as well.
I consider making Robot Framework more native in non-English speaking languages pretty important and thus assign this to RF 5.0 scope with critical priority. The old issue about non-English Given/When/Then prefixes (#519) is highly related and already in RF 5.0 scope.
There are many other related enhancements like translating log and report, translating error message, translating keywords used in generic libraries, and so on. They all require their own issues and probably need to wait for future RF versions.
Activity
bhirsz commentedon Sep 24, 2021
Leaving myself here so I will remember to add option for robotidy to autotranslate tokens. And it would be interesting to add support for polish. Although I don't have idea how to translate some of the keywords such as [Teardown] (probably not
[Zburzyć]:D). Maybe to avoid problems with not accurate translations it would be good idea to let people vote on certain translations? Or use https://crowdin.com .pekkaklarck commentedon Sep 24, 2021
Yeah, coming up with good translations for some of these terms is going to be hard. No idea what Teardown could be in Finnish either. A major problem related to this is that changing terms would be backwards incompatible. Perhaps we should support English always so that hard-to-translate terms could be initially skipped.
Snooz82 commentedon Oct 1, 2021
Great Idea.
pekkaklarck commentedon Jan 17, 2022
We decided to move this one and highly related non-English Given/When/Then support (#519) to RF 5.1. That wasn't done because we don't consider these issues important, on the contrary, but simply because RF 5.0 already contains lot of great new features and we want to get it out as soon as possible. These translation related issues will be the highest priority issues in RF 5.1 and the plan is to start its development right after RF 5.0 has been released.
yanne commentedon Apr 9, 2022
We need to do some technical choices before proceeding with the implementation.
The goals here are:
Since this is mostly a lookup problem (does a given string, say
*** testitapaukset ***, represent a valid token), some kind of configuration file is most likely appropriate. A full-blown translation framework like gettext might be too complicated.In addition, it needs to be decided whether we support multiple forms for some tokens. For example, currently the table headers allow both singular and plural English form (
test caseandtest cases). For the sake of simplicity and clarity, it might be better to allow just one form in the translations.Based on all the above, some options for the configuration file format are:
Of these, INI files and JSON are the ones having parsers in the Python standard library.
JSON is quite unwieldy to edit by hand and it does not support comments, and additionally no benefit is gained by it's support for a wider range of data types than INI files.
mkorpela commentedon Apr 9, 2022
I would really like to also results be considered. How does log.html look like
and could we allow to some extent results automatic translations.
mkorpela commentedon Apr 9, 2022
@yanne one thing I would also think are the existing standards and work beyond Python standard libs.
JSON is pretty much used in projects like i18next and all over the content of internet (like in headless cms).
It might actually result in best tooling for content creation for the translations.
pekkaklarck commentedon Apr 9, 2022
Translating log and report is important but it would most likely be better to update their underlying tech first. We are planning to do such tech update with Libdoc already in RF 5.1 (#4304) and if that goes well then log/report could be next.
d-biehl commentedon Apr 9, 2022
Regarding technical choices:
What about the python gettext API, it comes with python and is a well established standard, editing and handling PO files is easy and there are several tools wich helps you to write your translations.
13 remaining items
emanlove commentedon Jun 14, 2022
I would suggest we use and stick to whatever the commonly accepted syntax for describing languages is. I think is the ISO standard - ISO 639-1 and then the additional macrolanguages. I would stick to the hyphen and be strict in interpreting it.
HelioGuilherme66 commentedon Jun 14, 2022
Better use the hyphen then. The following should be accepted:
pt(this is the preferable, nice to have a lookup for regional LANG code page, and switch to it, otherwise, default would bept-pt),pt-ptandpt-br.There may be more regional variants, like for example, Angola.
(I haven't looked at code, but maybe a specific Robot Framework language environment variable could exist):
No
--languageoption ==> Lookup ROBOT_LANG ==> English (en) If None else ROBOT_LANGWith
--language pt==> Lookup ROBOT_LANG ==>pt-ptIf None else ROBOT_LANG (user would need--language ento bypass ROBOT_LANG)With
--language pt-pt==> no lookup for ROBOT_LANG ==>pt-ptWith
--language pt-br==> no lookup for ROBOT_LANG ==>pt-brWith
--language fi==> no lookup for ROBOT_LANG ==>fi(applicable for all languages with no regional variants)pekkaklarck commentedon Jun 15, 2022
I don't think we need an environment variable to control the language. We already support
ROBOT_OPTSand giving it a value like--language pthas the same effect as the proposedROBOT_LANGwith valuept. I'd also rather think about adding support for config files than add more environment variables. I'm not entirely against the idea, though, so you can submit a separate issue to discuss it further.pekkaklarck commentedon Jun 15, 2022
I don't want to make handling language codes too complicated at least in RF 5.1. For example, I don't want to do any extra lookups if someone uses
ptand notpt-pt. We just need to decide which one to use or make it so that both mean the same thing.The hyphen in
pt-bris easiest to handle so that we simply ignore it when matching the given language code to the available ones. Then the class name can be justPtBrand matching it works. Alternatively we could require the class name to bePt_Brin this case or require the class to have an attribute telling the language code to use. I don't think these have any concrete benefits over simply ignoring the hyphen in matching. That obviously means thatptbrworks in addition topt-br, but I don't think that really matters.pekkaklarck commentedon Jun 15, 2022
Big thanks for @leeuwe for setting up Crowdin to have a place where the community can work together with translations. Thanks also to everyone who has already participated in translation efforts.
If you want to test translations created at Crowdin, you need to download the language file (seems to be named
Core.yml) and convert it to Python that Robot Framework understands. I have created a script that can do conversion automatically. Just download the script and run it like this:The generated Python code can be used directly with Robot Framework like
robot --language lang.py tests.robot. The generated class can also be added to Robot's languages module via a pull request to get it included as a built-in language.Create Languages instance earlier for performance
Better error handling with --language files. #4096 #519
pekkaklarck commentedon Jul 6, 2022
The support for localized markers ought to be done now. We still need to add actual translations and document all this, but that's covered by #4390.
Add translation support for task related setting aliases.
pekkaklarck commentedon Oct 11, 2022
@d-biehl helped making the public
robot.api.LanguagesAPI used by external tools like editor plugins better. See #4494 for details.