Behat / Gherkin

Gherkin parser, written in PHP for Behat project
MIT License
1.05k stars 92 forks source link

Filters are hardcoded in english #169

Open seblaz opened 4 years ago

seblaz commented 4 years ago

Hi! I just noticed that the filters (Behat\Gherkin\Filter\RoleFilter for example) has the as an string hardcoded. This makes it imposible to use some role-based features in other languages.

Update: It looks like the only filter with hardcoded strings is the RoleFilter.

stof commented 3 years ago

As far as I can tell, this RoleFilter is something that was invented by Behat, with no equivalent in Cucumber. So on their side, they don't have any need for i18n for this.

@seblaz there is a NarrativeFilter supporting arbitrary regexp

ciaranmcnulty commented 3 years ago

As it's not part of the gherkin (it's part of our stuff) we could have it in the localist translations in Behat/Behat somehow?

stof commented 3 years ago

I think the whole Behat\Gherkin\Filter thing should actually not be in behat/gherkin as this is about implementing the filtering for Behat suites, not about parsing gherkin.

Tag expressions would make sense to implement as a dedicated package too (maybe semi-generated in cucumber too as for other languages) rather than implementing that inside the TagFilter directly (moved to Behat or no).

ciaranmcnulty commented 3 years ago

I imagine it's done this way because in theory a more complex Loader (e.g. coming from a web service or database) would benefit from filtering at the source.

stof commented 3 years ago

@ciaranmcnulty Behat won't expose filters to the loader directly as far as I remember. They are only used later.

ciaranmcnulty commented 3 years ago

Oh, huh true