Skip to content
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

Improved syntax for translate script? #81

Closed
OiNutter opened this issue Oct 27, 2011 · 2 comments
Closed

Improved syntax for translate script? #81

OiNutter opened this issue Oct 27, 2011 · 2 comments

Comments

@OiNutter
Copy link
Contributor

In reference to pull request #74 and my comments on 66fb4f9 about trying to find a more natural way of writing the command I'm wondering what people's thoughts would be about using the following regexp:

/(?:translate)(?: me)? ("(.[^"]*)"(?:(?: from) ([a-z]*))?(?:(?: (?:in)?to) ([a-z]*))?|(?:.[^"]*))/i

which would give the option of either

hubot translate me <phrase>

or

hubot translate me "<phrase>" from <source> into <target>

Where the from and into sections are optional. It basically comes down to whether people would prefer the current order where the comes last and no double quotation marks are required, or this which feels more natural to me? I've kept it as double quotation marks as singles may be part of the word or phrase to be translated.

I've also changed some of the non required groups such as (translate) to non matching groups to tidy up the results to pull in. I'll do this whichever way people decide the command should work. When people decide I'll submit a pull request with the updated code.

@atmos
Copy link
Contributor

atmos commented Oct 29, 2011

I really don't like having to quote things. I kinda like what's there now.

@atmos atmos closed this as completed Oct 29, 2011
@OiNutter
Copy link
Contributor Author

No problem, that was my concern in the first place, just wasn't sure what people would prefer. I'll just tidy up the current regexp with non-matching groups to make it cleaner.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants