pytest-bdd icon indicating copy to clipboard operation
pytest-bdd copied to clipboard

Add gettext support

Open dutradda opened this issue 5 years ago • 13 comments

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.

dutradda avatar Jun 28 '19 15:06 dutradda

@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.

dutradda avatar Jun 28 '19 16:06 dutradda

Coverage Status

Coverage increased (+0.07%) to 93.615% when pulling 4a5248216b83527ac45c9908e7054a1bb0dddfd2 on dutradda:gettext-support into 72a8764556cdecb96c8ce44861af8de1a5726c9c on pytest-dev:master.

coveralls avatar Jun 28 '19 16:06 coveralls

Travis has been fixed on master so you can revert your travis related changes

sliwinski-milosz avatar Jul 09 '19 09:07 sliwinski-milosz

@sliwinski-milosz code updated

dutradda avatar Jul 10 '19 13:07 dutradda

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.

olegpidsadnyi avatar Aug 02 '19 08:08 olegpidsadnyi

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

olegpidsadnyi avatar Aug 02 '19 08:08 olegpidsadnyi

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.

youtux avatar Aug 02 '19 08:08 youtux

@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 avatar Aug 02 '19 14:08 dutradda

@dutradda, if you are willing to work on this, I would propose to continue in this way:

  1. add the dependency gherkin-official to this project
  2. 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 avatar Aug 02 '19 14:08 youtux

@youtux I'll do it and keep you informed

dutradda avatar Aug 02 '19 14:08 dutradda