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

Implement localisation support #725

Merged
merged 6 commits into from
Oct 25, 2024
Merged

Implement localisation support #725

merged 6 commits into from
Oct 25, 2024

Conversation

youtux
Copy link
Contributor

@youtux youtux commented Oct 19, 2024

Fixes #397
Supersedes #345

Checklist:

  • Find all usages of keyword and check if we need to replace them with keyword_type

@youtux
Copy link
Contributor Author

youtux commented Oct 19, 2024

@jsa34 mind reviewing this too?

Copy link

codecov bot commented Oct 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.64%. Comparing base (c92f8a6) to head (06b4cca).
Report is 9 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #725      +/-   ##
==========================================
+ Coverage   95.63%   95.64%   +0.01%     
==========================================
  Files          54       54              
  Lines        2083     2091       +8     
  Branches      231      230       -1     
==========================================
+ Hits         1992     2000       +8     
  Misses         55       55              
  Partials       36       36              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jsa34
Copy link
Collaborator

jsa34 commented Oct 20, 2024

There are some places where keywords are hardcoded, but I needed to resolve these for #727.

This PR should fix this issue so that the gherkin terminal reporter and cucumber json out is using the desired keywords from the feature file, rather than assuming

@jsa34
Copy link
Collaborator

jsa34 commented Oct 20, 2024

We should include the language in the cucumber json output.

https://github.com/cucumber/compatibility-kit/blob/main/devkit/samples/minimal/minimal.feature
https://github.com/cucumber/compatibility-kit/blob/main/devkit/samples/minimal/minimal.feature.ndjson

This is example of a minimal out that is cucumber-spec-compliant, and as no language is specified, it defaults to "en" in this example, but obviously we should pass the value coming from the gherkin parser.

Copy link
Collaborator

@jsa34 jsa34 left a comment

Choose a reason for hiding this comment

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

See comments in the PR

@jsa34
Copy link
Collaborator

jsa34 commented Oct 20, 2024

Also resolves #179

@jsa34 jsa34 mentioned this pull request Oct 20, 2024
@jsa34
Copy link
Collaborator

jsa34 commented Oct 20, 2024

I also forgot an example and change log entry: it would be helpful to demonstrate how to specify the language in the feature file

Copy link
Collaborator

Choose a reason for hiding this comment

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

There is another type to map: Conjunction (And, But and *)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I know, but that's just a "tokenizer" type, not a semantic one, that's why I didn't include it here

@youtux
Copy link
Contributor Author

youtux commented Oct 24, 2024

We should include the language in the cucumber json output.

https://github.com/cucumber/compatibility-kit/blob/main/devkit/samples/minimal/minimal.feature https://github.com/cucumber/compatibility-kit/blob/main/devkit/samples/minimal/minimal.feature.ndjson

This is example of a minimal out that is cucumber-spec-compliant, and as no language is specified, it defaults to "en" in this example, but obviously we should pass the value coming from the gherkin parser.

Do you know if there is a specification somewhere for Cucumber JSON output?

@youtux youtux requested a review from jsa34 October 24, 2024 17:03
@youtux
Copy link
Contributor Author

youtux commented Oct 24, 2024

I also forgot an example and change log entry: it would be helpful to demonstrate how to specify the language in the feature file

yes I forgot indeed, added in 342cf5e

@jsa34
Copy link
Collaborator

jsa34 commented Oct 24, 2024

We should include the language in the cucumber json output.
https://github.com/cucumber/compatibility-kit/blob/main/devkit/samples/minimal/minimal.feature https://github.com/cucumber/compatibility-kit/blob/main/devkit/samples/minimal/minimal.feature.ndjson
This is example of a minimal out that is cucumber-spec-compliant, and as no language is specified, it defaults to "en" in this example, but obviously we should pass the value coming from the gherkin parser.

Do you know if there is a specification somewhere for Cucumber JSON output?

Messages/JSON:
https://github.com/cucumber/messages/tree/main/jsonschema

and legacy JSON:
https://github.com/cucumber/cucumber-json-schema/tree/main/schemas

@jsa34
Copy link
Collaborator

jsa34 commented Oct 24, 2024

I think the parser test needs simplifying otherwise it will be a maintenance nightmare.
Perhaps just fix for this and then I will raise a PR to make the test more focussed.

@youtux
Copy link
Contributor Author

youtux commented Oct 25, 2024

I think the parser test needs simplifying otherwise it will be a maintenance nightmare. Perhaps just fix for this and then I will raise a PR to make the test more focussed.

Agree, but I think that once gherkin-official v30.0.0 is released, we can remove most of the classes in gherkin_parser.py, so let's wait for that one.

Can you check this again?

@youtux youtux mentioned this pull request Oct 25, 2024
@youtux youtux merged commit dcafea0 into master Oct 25, 2024
15 checks passed
@youtux youtux deleted the implement-localisation branch October 25, 2024 20:24
@jsa34
Copy link
Collaborator

jsa34 commented Oct 25, 2024

All good to me now :)

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.

Gherkin Localization Issue ?
2 participants