Skip to content

Loading…

Support multiple languages #6

Closed
txus opened this Issue · 11 comments

5 participants

@txus
Codegram member

No description provided.

@mrcasals
Codegram member

Any idea on how to start working on this?

@mrcasals
Codegram member

I need this, I'll start working on it and ask form help if I get stuck... But it looks like I should start from here, right?

https://github.com/codegram/gherkin-ruby/blob/master/lib/gherkin/parser/lexer.rb#L61-104

@txus
Codegram member

We need to hook into the lexer (defined here, the file you mentioned is autogenerated from this one) to identify the header like:

# language: ca
Feature: Fer alguna cosa

And then use the corresponding set of tokens. The lexer is written in Rexical, so we just need to figure out how to execute some code before, dynamically set which set of tokens are we using, and then let the lexer tokenize the file, and then we're done. Makes sense?

@txus
Codegram member

Actually it's very easy, look at this part of the code. Here, before the call to scan_setup(code), we should define an instance variable with a hash or something like this:

locale = code.scan(/language/ bla bla whatever
@tokens = get_tokens_from_locale(locale) # => this would return something like { :When => "Quan", :Then => "Llavors" ... }
scan_setup(code)

And then I don't know how to use these tokens in the lexer. But it's something. What do you think?

@mrcasals
Codegram member
@txus
Codegram member

Just a small status update, anyone up for implementing this? @mrcasals @Dor3nz @divins @oriolgual @josepjaume ?

@oriolgual
Codegram member

We haven't actually needed this, so.... :P

@mrcasals
Codegram member
@txus txus referenced this issue in codegram/spinach
Closed

support I18N features #91

@21croissants

Sorry, I will not contribute because I'm working on my own vegetable: a Gherkin DSL on top of RSpec: https://github.com/21croissants/maniok_bdd/

@oriolgual
Codegram member

OK, nevermind.

@oriolgual oriolgual closed this
@RunsFor

Hi,

I'm wondering if this feature are planned to be implemented?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.