[issue8841] GetoptError strings should be localized

2011-03-02 Thread Filip Gruszczyński
Filip Gruszczyński grusz...@gmail.com added the comment: Here is a small patch. Could you advise me, how can I test it now? Or is it an issue, that doesn't require writing new tests? -- keywords: +patch Added file: http://bugs.python.org/file20970/8841.patch

[issue8841] GetoptError strings should be localized

2011-03-01 Thread Filip Gruszczyński
Filip Gruszczyński grusz...@gmail.com added the comment: I'd be happy to provide a patch. How about extending getopt api to something like this: optlist, args = getopt.getopt(['-b'], 'e', not_recognized=no %s option, mate!) GetoptError: no -b option, mate! Or maybe you should provide a

[issue8841] GetoptError strings should be localized

2011-03-01 Thread Filip Gruszczyński
Filip Gruszczyński grusz...@gmail.com added the comment: One more solution. Maybe getopt should expose variables that hold error messages (rather than have them hardcoded in the code), that can be simply substituted by the user before he runs getopt? But I don't really like this one.

[issue8841] GetoptError strings should be localized

2011-03-01 Thread Éric Araujo
Éric Araujo mer...@netwok.org added the comment: Filip: The standard way of doing localization is thanks to the gettext module. Richard: Regarding the contents of the error messages, please make specific remarks on what is lacking. -- stage: - needs patch versions: +Python 3.3

[issue8841] GetoptError strings should be localized

2011-03-01 Thread Filip Gruszczyński
Filip Gruszczyński grusz...@gmail.com added the comment: I understand I should do something similar to what is done in argparse: from gettext import gettext as _, ngettext ... message = ngettext('conflicting option string: %s', 'conflicting option strings: %s',

[issue8841] GetoptError strings should be localized

2011-03-01 Thread Richard Lowe
Richard Lowe richl...@richlowe.net added the comment: I don't find anything lacking about the error messages, I meant that there were no more specific exceptions, or fields in GetoptError to allow the caller to tell what was specifically wrong and provide its own localized messages. So while

[issue8841] GetoptError strings should be localized

2011-03-01 Thread Éric Araujo
Éric Araujo mer...@netwok.org added the comment: Richard: It’s not common to use subclasses to allow message customization. Would gettext cover your need? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8841

[issue8841] GetoptError strings should be localized

2011-03-01 Thread Richard Lowe
Richard Lowe richl...@richlowe.net added the comment: Sure, just localizing them in the getopt implementation would be fine. I suggested subclassing to solve the more general problem of the caller being able to tell one getopt error from another, for which it is a pretty common solution.

[issue8841] GetoptError strings should be localized

2010-11-27 Thread Éric Araujo
Éric Araujo mer...@netwok.org added the comment: Do you want to provide a patch? -- nosy: +eric.araujo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8841 ___

[issue8841] GetoptError strings should be localized

2010-07-10 Thread Terry J. Reedy
Changes by Terry J. Reedy tjre...@udel.edu: -- versions: +Python 3.2 -Python 2.6 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8841 ___ ___

[issue8841] GetoptError strings should be localized

2010-05-27 Thread Richard Lowe
New submission from Richard Lowe richl...@richlowe.net: The GetoptError exception raised by getopt.getopt() to indicate errors in provided arguments seems intended to be displayed to the user[1], but is not localized and doesn't contain enough information, short of interpreting the error