Skip to content

Fix #1: analyze localized (non-English) feature files - #3

Merged
Karzone merged 2 commits into
mainfrom
fix/i18n-feature-file-dialects
Jul 23, 2026
Merged

Fix #1: analyze localized (non-English) feature files#3
Karzone merged 2 commits into
mainfrom
fix/i18n-feature-file-dialects

Conversation

@Karzone

@Karzone Karzone commented Jul 23, 2026

Copy link
Copy Markdown
Owner

Closes #1.

Problem

Structural Gherkin keywords (Feature:/Background:/Scenario:/Scenario Outline:/Examples:) were hardcoded English and the # language: header was never read. A localized feature file — e.g. # language: de with Szenario:, Beispiele: — was silently under-parsed: its scenarios weren't counted and its Beispiele: table was never found, which broke undefined-placeholder (data-error) detection too.

Change

  • Add GherkinDialect + GherkinDialectProvider, backed by the canonical gherkin-languages.json (vendored from cucumber/gherkin, embedded as a resource). The provider reads the # language: header, defaulting to English when absent.
  • Route the block/step keyword checks in DuplicateAnalyzer, GherkinNarrativeGuard, and StepDefinitionCoverageAnalyzer through the dialect. Step-keyword matching stays case-sensitive per dialect (faithful to the real Gherkin parser).
  • English files keep using the configured StepKeywords (unchanged); localized files use their dialect's keywords.
  • Two keyword sites are intentionally left English (they only ever see already keyword-stripped step text or English-authored binding regexes) — documented inline.

Behavior note (intended)

Using the canonical en table means English now also recognizes the standard Gherkin synonyms Example: and Scenarios:. This is more spec-correct and has no collisions with the sample corpus. Issue #1's acceptance criteria were updated to match.

Tests — 225 pass (6 new, 219 existing, 0 regressions)

  • German file → scenarios counted + undefined placeholder detected
  • English file → undefined placeholder still detected (regression guard for a parse path nothing else covered)
  • Embedded-resource load + # language: header detection
  • Coverage path: a German step matches its binding; German narrative prose is correctly not parsed as a step

Licensing

gherkin-languages.json is MIT (cucumber/gherkin). Since it's embedded and shipped in the packed NuGet tool, THIRD-PARTY-NOTICES.md records the source, exact upstream commit SHA, and MIT license text, and is packed into the package.

🤖 Generated with Claude Code

Karzone and others added 2 commits July 23, 2026 12:34
Structural Gherkin keywords (Feature/Background/Scenario/Scenario Outline/
Examples) were hardcoded English and the `# language:` header was never read,
so a localized feature file (e.g. `# language: de` with Szenario:, Beispiele:)
was silently under-parsed: its scenarios were not counted and its Examples
table was never found, which also broke data-error (undefined-placeholder)
detection.

- Add GherkinDialect + GherkinDialectProvider, backed by the canonical
  gherkin-languages.json (vendored from cucumber/gherkin, embedded as a
  resource). The provider reads the `# language:` header (English if absent).
- Route DuplicateAnalyzer's block/step keyword checks through the dialect.
  English files keep using the configured StepKeywords (unchanged behavior);
  localized files use their dialect's keywords.
- Make GherkinNarrativeGuard + StepDefinitionCoverageAnalyzer dialect-aware
  (block-boundary + case-sensitive step-keyword matching per dialect).
- Tests: German file scenarios counted + undefined placeholder detected;
  English regression (undefined placeholder still detected); embedded-resource
  load; coverage path matches a German step and rejects German narrative prose.

Note: using the canonical `en` table means English now also recognizes the
standard Gherkin synonyms (Example:, Scenarios:) — more spec-correct, and no
sample-corpus collisions.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Records source, upstream commit SHA, and cucumber/gherkin's MIT license, and
ships it in the NuGet package. Required since the data file is embedded and
redistributed via the packed tool.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@Karzone
Karzone merged commit 87ec7c9 into main Jul 23, 2026
1 check passed
@Karzone
Karzone deleted the fix/i18n-feature-file-dialects branch July 23, 2026 14:38
Karzone added a commit that referenced this pull request Jul 24, 2026
Fix #1: analyze localized (non-English) feature files
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.

Only analyzes English feature files (# language: / localized keywords ignored)

1 participant