Stories in other languages
Reported by Nando | February 2nd, 2008 @ 12:07 PM
Hello,
I think it would be nice for developers with non-english clients to open the possibility for writing RSpec Stories in other languages.
Currently the story template words ("Story", "Scenario", "Given", etc.) are hard-coded, but it shouldn't be difficult to manage them as, for example, a configurable hash.
I don't have a good knowledge of the code behind RSpec but I've managed to modify 1.1.3 (r3281) code to achieve that goal. Now I can run my brand-new spanish stories!
I send the differences with the 3281 revision attached. Before I run the stories I set the value of the words:
Spec::Runner.configure do |config|
config.with_story_template_words({
:story => "Relato",
:scenario => 'Escenario',
:given => 'Dado',
:given_scenario => 'DadoElEscenario',
:when => 'Cuando',
:then => 'Entonces',
:and => 'Y'
})
end
I'm sure it's not the best way to implement the functionality, but I just want to let you know the "desire" and a (very) simple way to get it (partially, I only use PlainText output) done.
Thanks for listening ;)
Cheers!
Nando
Comments and changes to this ticket
-
Nando February 3rd, 2008 @ 02:44 AM
Hi!
after reading the official (and obvious) way to request a new RSpec feature like this I couldn't wait a minute to start writting the story for my ticket.
I attach a tarball with the ticket story ready to be run as part of the RSpec Stories suite. It has the following files:
[in rspec/stories/multilingual/]
- multilingual: the story itself [1]
- stories.rb: the story runner
[in spec/stories/resources/]
- /helpers/spanish_helper.rb: require & spanish keywords (Relato, Escenario, etc.)
- /stories/relato_en_texto_plano: spanish story
- /stories/plain_text_story_in_spanish.rb: runner for the first scenario
- /stories/plain_text_story_in_spanish_with_steps.rb: runner for the second one
Story: Writting stories in other languages As a non-english RSpec developer I want to write stories in my mother tongue So that I don't have to make an extra effort to know what's going on Scenario: Pending Given the file stories/plain_text_story_in_spanish.rb When I run it with the ruby interpreter Then the exit code should be 0 And the stdout should match /1 scenarios: 0 succeeded, 0 failed, 1 pending/m And the stdout should match /4\) La portada de Mi Sitio en La Red/ Scenario: Succeed Given the file stories/plain_text_story_in_spanish_with_steps.rb When I run it with the ruby interpreter Then the exit code should be 0 And the stdout should match /1 scenarios: 1 succeeded, 0 failed, 0 pending/mThanks a lot!
-
Aslak Hellesøy February 3rd, 2008 @ 07:23 PM
- → State changed from new to open
- → Assigned user changed from to Aslak Hellesøy
This is great - we need Norwegian support too, so I'll apply this when I get a chance.
-
Nando February 6th, 2008 @ 12:53 AM
Aslak,
I think it would be good also to establish a set of convention words for every language supported, so that if the language you need is between them and you use that words you don't have to translate them all. For example, we could have something like:
Spec::Runner.configure do |config| config.story_template_lang = "no" endto activate the Norwegian set of convention words.
If your language isn't yet supported or you don't like the convention you could always define your own set of words.
Takk så mye!
-
Nando August 13th, 2008 @ 07:48 PM
- → Tag changed from to featurerequest plaintext storyframework
Hi!
I've just pushed this feature on my rspec fork:
http://github.com/nando/rspec/tree
Cheers, Nando
-
Aslak Hellesøy August 14th, 2008 @ 05:02 PM
- → Tag changed from featurerequest plaintext storyframework to cucumber featurerequest plaintext storyframework
Thanks Nando.
As mentioned on the RSpec dev list I've written a much improved successor of the story runner.
It has i18n built in and it's easy to add others.
Personally I'll put my efforts into Cucumber (which might become the official successor of Story Runner).
-
Nando October 3rd, 2008 @ 07:02 PM
Congratulations Aslak!!!
Finally I've been playing with Cucumber and I think you're doing an awesome work.
I was so delighted that I've even posted it in my blog [1], showing how to write an "Hello World!" app with Rails, BDD and Cucumber (in spanish!).
Thanks for your work... Cucumber the Great!
[1] http://www.lacoctelera.com/nando...
pd: so... this_ticket.should be_closed (should_not it?;)
-
David Chelimsky October 4th, 2008 @ 12:22 AM
- → State changed from open to out-of-date
This is supported in cucumber.
Please Login or create a free account to add a new comment.
You can update this ticket by sending an email to from your email client. (help)
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
Behaviour Driven Development for Ruby.
