pytest-bdd
pytest-bdd copied to clipboard
Add gettext support
First translation was written for portuguese, according to https://cucumber.io/docs/gherkin/reference/#spoken-languages.
The PR also enables the language reset during runtime.
@youtux, @olegpidsadnyi and @sliwinski-milosz
Hello guys, can any of you take a look on my PR?
I have to change the tox/travis settings because the pytest 4.5 and after are crashing the tests.
Coverage increased (+0.07%) to 93.615% when pulling 4a5248216b83527ac45c9908e7054a1bb0dddfd2 on dutradda:gettext-support into 72a8764556cdecb96c8ce44861af8de1a5726c9c on pytest-dev:master.
Travis has been fixed on master so you can revert your travis related changes
@sliwinski-milosz code updated
To be honest I don't really understand why do we need gettext for 11 keywords. This seems like an overkill. Another point is the current language. I think this should be a pytest option that the plugin introduces.
The whole point is to be compatible with the cucumber? To let people use pytetst instead of cucumber? Then the language support is like this: https://cucumber.io/docs/gherkin/reference/#spoken-languages
#language header, and only keywords. There's no need in gettext. This is just a simple dict lookup once the header is set on the feature file. Otherwise english.
See https://github.com/cucumber/gherkin-python/blob/master/gherkin/gherkin-languages.json
Maybe we should instead import and use gherkin and delegate the parsing of feature files to this library, provided by cucumber.io. If we use that, we will have automatic support for all the languages, and issues like #311 would probably not exist, or they would have to be fixed by the upstream.
@olegpidsadnyi and @youtux How we can proceed?
I really want to see multiple languages support on pytest-bdd
. We already written the feature files in portuguese here. And the Gherkin language recommends that.
I can change my PR to fit the needs of the project. But I need to know the next steps.
@dutradda, if you are willing to work on this, I would propose to continue in this way:
- add the dependency
gherkin-official
to this project - parse feature files with that library, instead of having our own parsing logic
I am not sure how much work it would require, but I think it is a viable option.
@youtux I'll do it and keep you informed