Search⌘ K
AI Features

Adding Localization Support to the Gherkin Parser

Explore how to update a Gherkin parser to support localization by managing internal keyword mappings and implementing locale parameters. Learn to handle language headers within test files and correctly parse multilingual Gherkin features, improving parser flexibility and Laravel application internationalization.

We'll cover the following...

The Norwegian sample feature

One of the more interesting aspects of the Gherkin language is the fact that the language itself supports localization, which our parser currently will not handle that well. Consider the code below, which is a sample feature test written in Norwegian:

C++
Funksjonalitet: Gjett et ord
Eksempel: Ordmaker starter et spill
Når Ordmaker starter et spill
Så må Ordmaker vente på at Gjetter blir med
Eksempel: Gjetter blir med
Gitt at Ordmaker har startet et spill med ordet "bløtt"
Når Gjetter blir med på Ordmakers spill
Så må Gjetter gjette et ord på 5 bokstaver

If we attempt to parse this currently, our parser will ...