ExGherkin v0.1.0 ExGherkin.Scanner.LanguageSupport View Source
The main purpose of this module is to facilitate full international language support by normalizing each entry under 'gherkin-languages.json' to the following format:
%{
# Top Level Gherkin Keywords
feature: ["Feature", "Business Need", "Ability"],
rule: ["Rule"],
background: ["Background"],
scenario_outline: ["Scenario Outline", "Scenario Template"],
example: ["Example", "Scenario"],
examples: ["Examples", "Scenarios"],
# Step Level Gherkin Keywords
given: ["Given "],
when: ["When "],
then: ["Then "],
and: ["And "],
but: ["But "],
# Meta
name: "English",
native: "English",
direction: :ltr,
homonyms: %{
"* " => %{
given: :when,
when: :then
then: :and,
and: :and,
but: :but,
default: :given,
}
},
}
and persisting the same as 'gherkin-languages.few.terms'.
The # Meta
section comprises of the keys :name
and :native
which
are part and parcel of the gherkin-languages.json standard. The
other keys are newly introduced:
:direction
is to designate if it pertains a:ltr
(Left to Right) or:rtl
(Right to Left) language. This can be derived thanks to the contents under:native
.:homonyms
represent the various keywords that are the same accross languages, such as "* " to mean any of the Step Level Gherkin Keywords or within a language, such as"Tha "
for old English to meanWhen
andThen
. Currently thehomonyms
existent are:- 'Агар '
- '* '
- 'अनी '
- 'Tha '
- 'Þá '
- 'Ða '
- 'Þa '
Each homonym has a sequence of keywords that it can logically revolve to. For the above sample presented, this would mean that the following feature:
```cucumber
Feature: Some Feature
Scenario: Some Scenario
* A
* B
* C
* D
```
could be interpreted as:
```cucumber
Feature: Some Feature
Scenario: Some Scenario
Given A
When B
Then C
And D
```
Link to this section Summary
Functions
Convenience function that provides the contents under the resource: 'gherkin-languages.few.terms'
Loads: 'gherkin-languages.few.terms' as Erlang compatible terms
.
Parses the content of 'gherkin-languages.json' into the desired format.
Saves parsed content to: 'gherkin-languages.few.terms' in binary
format.
Link to this section Functions
Convenience function that provides the contents under the resource: 'gherkin-languages.few.terms'
Loads: 'gherkin-languages.few.terms' as Erlang compatible terms
.
parse(source \\ "gherkin-languages.json", all_homonyms \\ ["Агар ", "* ", "अनी ", "Tha ", "Þá ", "Ða ", "Þa "], languages \\ :all)
View SourceParses the content of 'gherkin-languages.json' into the desired format.
unload(source \\ "gherkin-languages.json", resource \\ "gherkin-languages.few.terms", homonyms \\ ["Агар ", "* ", "अनी ", "Tha ", "Þá ", "Ða ", "Þa "], languages \\ :all)
View SourceSaves parsed content to: 'gherkin-languages.few.terms' in binary
format.