-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature Lang] Using different spoken languages #23
Comments
Thanks for the suggestion. I also would like to have this feature, but I am not sure yet how to implement it. The easiest thing would probably be to make the lexer configurable at runtime, but I don't know whether that's possible with the generated ANTLR lexer. |
I looks like possible. I do some tests right now. You could also look at: http://www.eclipse.org/forums/index.php/m/901545/ |
That would probably be the easiest solution if we could implement it by Am 14.08.2012 um 08:35 schrieb Boris Brodski [email protected]: I looks like possible. I do some tests right now. You could also look at: — |
I managed to override a simple keyword within the main parser and the ui-parser. The problem I stuck with is the auto completion. As you can imagine, the original (english) keyword still get shown... |
This is great news! The keywords are currently hardcoded in the proposal provider. Could this be the cause of your problem? On Sep 24, 2012, at 4:29 PM, Boris Brodski wrote:
|
I experimented with my own small project. The terminals you defined in Jnario are tricky. But I'm sure, if I get it with my test project, I will get it with the Jnario also. I should probably push it to the github. |
I still wouldn't consider the code completion to be a limiting factor, as we had to override the proposals for steps in Jnario anyway. This could be easily adapted to support "generic" keywords. On Sep 24, 2012, at 4:37 PM, Boris Brodski wrote:
|
Hey guys, I've just discovered Jnario 2 minutes ago and I'm pretty excited about it! (I come from Behat/PHPSpec from the PHP world, looking for alternatives for a new java project) Browsing the issues in github I came with this one. Does this means Jnario doesn't support other languages than english for expressing features? That would be a show-stopper for me. :( |
@adrianmoya @sebastianbenz var Given=1 // ok In order to translate those terminals we actually need to generate a new lexer for each language. If you want, we could discuss this matter over the phone (this is the quickest way, I think). Just let me know and I send my phone number over the private twitter message. |
Currently I think that implementing a generator that generates all language specific lexers is the best idea. The generator could read the generated lexer(s) and replace the Given, When, Then keywords with their respective translations. The whole process could be integrated into the normal feature workflow. Btw we could use the cucumber language definition as input for the generator: https://github.com/cucumber/gherkin/blob/master/lib/gherkin/i18n.json |
https://github.com/cucumber/gherkin/blob/master/lib/gherkin/i18n.json looks very good. So, here is my idea. We can't just copy the Lexer and replace all "Given" by "Angenommen". The problem is, that those keywords are integrated into the complex decision tables (especially in case of Jnario with the complex terminal). What we need to do is to enhance Xtext. For example: --- example.xtext ------------------------------- languages "en", "de"; // Define languages available Model: Greeting: --- example.properties (default, could be optional) ------------------------------- --- example-de.properties (keywords for all defined non-en languages) ------------------------------- The Xtext generator has to be extended with a pre-processing step: for language : languages Add new interface: interface ILocaleProvider { Then if languages.size>1 bind Lexer to LexerDelegator, that calls the determineLocale() and pass all calls to the right lexer. The potential problem: |
I posted a proposal draft here: http://www.eclipse.org/forums/index.php/t/439313/ |
After the discussion I would also say that adding such a feature wouldn't make much sense for xtext, as the use case is usually not that relevant. Furthermore, adding such a feature to Xtext would require a lot of work and would make a lot of things unnecessarily complicated. But Hendrik's suggestion sounds reasonable good and would be worth a try. What do you think? |
Issue sebastianbenz#23 Fix richstring tests
With cucumber it is possible to use different spoken languages within feature definitions:
https://github.com/cucumber/cucumber/wiki/Spoken-languages
It would be great, if Jnario had the same feature too. I think, that the solution with the '# language: XX' first line comment would be convenient way to do this.
Thank you for the great tool !
The text was updated successfully, but these errors were encountered: