peerapats / atom-language-gherkin

Gherkin language support for Atom
26 stars 18 forks source link

Support of i18n #5

Closed mackoj closed 9 years ago

mackoj commented 9 years ago

Hi,

Thanks for your package.

Wouldn't it be great if it could support i18n base on gherkin/i18n.json file ?

mackoj commented 9 years ago

By the way i'm working on an autocomplete plugin for Gherkin. I will love to have more documentation on what correspond each of your pattern in your gherkin.cson. Something like a illustrated example of each pattern would really help me a lot.

Thanks,

jossemarGT commented 9 years ago

Hi there! I was about to bump this request, but unfortunately as we can see in the atom docs, grammars are designed for a set of keywords.

I think that the best approach is to fork this repo and publish the domain specific translation. But if someone else has a better idea I'll be glad helping to make it real :+1:

Regards :octocat:

peerapats commented 9 years ago

@jossemarGT Yes, I think it might not easy to consolidate i18n file with atom grammar coz its limitation, that's why I have seen people fork this repos and add their language support, so that is OK until we found the better way.

@mackoj How about autocomplete that you want? If it's just gherkin keywords like Scenario, Given, When, Then etc. I have a plan to add snippets soon.

Regards,

mackoj commented 9 years ago

@jossemarGT: I don't think that forking this repo is the best solution. I think it could better if we group our effort into one repo. The idea is to automate the generation of gherkin.cson with a script. We can use the actual gherkin.cson file as a template and then fill it with the corresponding strings for each language. So that for each update of i18n.json or gherkin.cson (the template version of it), we just have to re-run this script. Also, it might be interesting to report our need to Github as they could provide a better way to handle this issue in the future.

@gigapixel: I want to be able to autocomplete using the autocomplete-plus api and to autocomplete from a file of token generated from our continuous integration server. The process is quite easy: each time we integrate our application, a script regenerates a token.json file. This file is an extract of all token and associated combinations available in our feature.rb files. We want to autocomplete with our token.json file as reference. So I will have all the possible sentences when writing a new scenario. The autocomplete plugin is able to update its token file in order to provide the best autocompletion possible.

Cheers,

teriiehina commented 9 years ago

Hello all,

The Atom docs for grammars is refering to a TextMate doc which mention the root level key firstLineMatch.

This key is :

a regular expression which is matched against the first line of the document (when it is first loaded). If it matches, the grammar is used for the document (unless there is a user override). Example: ^#!/.*\bruby\b.

Here's what I tried, worked fine:

screen_shot_2015-03-30_at_23-1 45 02

Then, in each of your .features file, you just need to add:

# language: fr

as explained in the Cucumber documentation for spoken languages

mackoj commented 9 years ago

I fork it finally. I will open source it soon.

mackoj commented 9 years ago

Done https://github.com/mackoj/language-gherkin-i18n

jossemarGT commented 9 years ago

@mackoj :+1: