[rspec-devel] New spoken language support for cucumber

aslak hellesoy aslak.hellesoy at gmail.com
Fri Oct 10 05:45:19 EDT 2008

On Thu, Oct 9, 2008 at 6:01 PM, Lian Liming <lianliming at gmail.com> wrote:
> Hi all,
> I still haven't found any documentation on how to add a new spoken
> language support to cucumber. I have tried following two steps to add
> a new one.
> 1) Add a new section to the languange.yaml and identify the
> translations of the keywords.
> 2) run rake -f gem_tasks/treetop.rake treetop:compile

Congrats you found out :-) The rake bit is actually a bit easier:
rake treetop:compile

> The new language I am trying to add is my mother tongue -- Chinese. By
> applying above steps, it basically works. The only thing I have to
> deal with is that, there is no space between keyword and rest of the
> sentence in Chinese language. That is also the important difference
> between Asian languages(including Chinese, Japanese, Korea)  and
> western languages (those have been supported in cucumber).
> Take a look at following example:
> In English: Given I have entered 50 into the calculator
> In Chinese: 假如我已经在计算器中输入了50
> To support native Chinese conventions, I have to change the treetop
> rules a little bit as following:
> ----  diff --------
> 34c34
> <     scenario_keyword space? name:line_to_eol steps:(space step_sequence)? {
> ---
>>     scenario_keyword space name:line_to_eol steps:(space step_sequence)? {
> 99c99
> <     given_scenario_keyword space? name:line_to_eol {
> ---
>>     given_scenario_keyword space name:line_to_eol {
> 108c108
> <     step_keyword space? name:line_to_eol {
> ---
>>     step_keyword space name:line_to_eol {
> ----  end of diff --------
> This change targets Asian languages and I don't know whether it breaks
> the conventions of western languages. I also would like to know if

You could have found out by running:
rake treetop:compile spec

Works fine it seems! I've just committed it:

> there is any more flexible solution of supporting different kinds of
> spoken languages. Any ideas?

I think it's easy enough - especially now that I've documented it a
little: http://github.com/aslakhellesoy/cucumber/wikis/spoken-languages

I'm really excited to see support for Chinese and other Asian
languages! I'm looking forward to pulling in your translation, Liming


> Liming
> _______________________________________________
> rspec-devel mailing list
> rspec-devel at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-devel

More information about the rspec-devel mailing list