[issue8841] GetoptError strings should be localized

2011-03-02 Thread Filip Gruszczyński
Filip Gruszczyński 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 ___ Pytho

[issue8841] GetoptError strings should be localized

2011-03-01 Thread Richard Lowe
Richard Lowe 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

2011-03-01 Thread Éric Araujo
Éric Araujo added the comment: Richard: It’s not common to use subclasses to allow message customization. Would gettext cover your need? -- ___ Python tracker ___ _

[issue8841] GetoptError strings should be localized

2011-03-01 Thread Richard Lowe
Richard Lowe 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 the defaults are unlo

[issue8841] GetoptError strings should be localized

2011-03-01 Thread Filip Gruszczyński
Filip Gruszczyński 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', len(conflict

[issue8841] GetoptError strings should be localized

2011-03-01 Thread Éric Araujo
Éric Araujo 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 -Python 3.2 __

[issue8841] GetoptError strings should be localized

2011-03-01 Thread Filip Gruszczyński
Filip Gruszczyński 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 Filip Gruszczyński
Filip Gruszczyński 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 dictionary? >>

[issue8841] GetoptError strings should be localized

2010-11-27 Thread Éric Araujo
Éric Araujo added the comment: Do you want to provide a patch? -- nosy: +eric.araujo ___ Python tracker ___ ___ Python-bugs-list maili

[issue8841] GetoptError strings should be localized

2010-07-10 Thread Terry J. Reedy
Changes by Terry J. Reedy : -- versions: +Python 3.2 -Python 2.6 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue8841] GetoptError strings should be localized

2010-05-27 Thread Richard Lowe
New submission from Richard Lowe : 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 string, for consumers to r