github/hubot — Issue #81: Improved syntax for translate script?
Author: OiNutter
Created: 2011-10-27 21:59:11+00:00
State: open

In reference to pull request #74 and my comments on 66fb4f9f12 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

or

hubot translate me "" from into

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.