Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: allow gherkin keywords as supported by cucumber #4784

Merged
merged 9 commits into from
Jan 29, 2025

Conversation

ebo-zig
Copy link
Contributor

@ebo-zig ebo-zig commented Jan 27, 2025

Motivation/Description of the PR

  • Description of this PR, which problem it solves
  • Resolves #issueId (if applicable).

Because managing translations of Gherkin keywords happens in this repo, the features cannot be run in every language. When setting the language of the feature to Dutch (nl), CodeceptJS threats it as English.

Therefore, the translations of keywords should be loaded from Cucumber: https://github.com/cucumber/gherkin/blob/main/javascript/src/gherkin-languages.json

Type of change

  • 🐛 Bug fix

Checklist:

  • Tests have been added
  • Documentation has been added (Run npm run docs)
  • Lint checking (Run npm run lint)
  • Local tests are passed (Run npm test)

@kobenguyent
Copy link
Collaborator

hi @ebo-zig actually, we are not only translating gherkin keywords, but also the codeceptjs actions are translated as well, so that's why there is now separated file for each language, for instance https://github.com/codeceptjs/CodeceptJS/blob/3.x/translations/de-DE.js

Scenario: gherkinTranslations[langCode].scenario[0],
ScenarioOutline: gherkinTranslations[langCode].scenarioOutline[0],
},
actions: {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ebo-zig may you help review this translation?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done! Came to the conclusion that the Dutch language is a little bit strange after reviewing this 😄

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haha, yeah, I could imagine that as I asked help from chatgpt to translate them. Thanks for the review!

@ebo-zig
Copy link
Contributor Author

ebo-zig commented Jan 27, 2025

Hi @kobenguyent, I agree with the fact that not only Gherkin keywords should be translated.

But re-defining the Gherkin translations feels a little bit duplicate to me. So, if that is what we want, then that is allright.

@kobenguyent
Copy link
Collaborator

Hi @kobenguyent, I agree with the fact that not only Gherkin keywords should be translated.

But re-defining the Gherkin translations feels a little bit duplicate to me. So, if that is what we want, then that is allright.

May you happen to have any better approaches for this?

@ebo-zig
Copy link
Contributor Author

ebo-zig commented Jan 27, 2025

I think there are two possible solutions:

  1. Fully support all languages, which means that you proposal is the way to go.
  2. Use the keywords of Gherkin as managed by Cucumber, as I am proposing.

The con of 1 is that using BDD tests in CodeceptJS doesn't work out of the box. And we are defining what already is defined by Cucumber.
The con of 2 is that you can use a language in BDD but using the same language in acceptance tests isn't always possible.

So there is no better approach IMO, other than chosing between the possible solutions.

@kobenguyent
Copy link
Collaborator

I think there are two possible solutions:

  1. Fully support all languages, which means that you proposal is the way to go.
  2. Use the keywords of Gherkin as managed by Cucumber, as I am proposing.

The con of 1 is that using BDD tests in CodeceptJS doesn't work out of the box. And we are defining what already is defined by Cucumber. The con of 2 is that you can use a language in BDD but using the same language in acceptance tests isn't always possible.

So there is no better approach IMO, other than chosing between the possible solutions.

thanks for your input!

@kobenguyent kobenguyent requested a review from DavertMik January 27, 2025 13:24
@DavertMik
Copy link
Contributor

Thank you! This looks really cool
I will check this tomorrow

@kobenguyent kobenguyent merged commit 236dc72 into codeceptjs:3.x Jan 29, 2025
12 checks passed
@ebo-zig ebo-zig deleted the fix/gherkin-i18n branch January 30, 2025 09:55
@ebo-zig
Copy link
Contributor Author

ebo-zig commented Jan 30, 2025

@kobenguyent is there any chance this change will be available soon in a new tag?

@kobenguyent
Copy link
Collaborator

@ebo-zig I could not say for certain when there would be a release, but of course, you could try [email protected] with latest changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants