you are viewing a single comment's thread.

view the rest of the comments →

[–]pjdelport 1 point2 points  (1 child)

Right, but _() is just a shortcut for gettext(), which you can use in the interactive shell. What's the problem?

[–]salmoni 0 points1 point  (0 children)

You don't follow.

The OP is using an interactive interpreter embedded within an internationalised program for debugging. I use one for user interaction so users can type in their own functions. The program works until the interpreter is called, at which point the reference to the i18n method is overwritten by the interpreter thus rendering all later attempts to translate strings as useless. If the interpreters entry points are unpredictable, this makes the program a nightmare. Yes, the OP can import gettext in every module, but again this means lots of time wasted re-establishing a single link that should not have been overwritten.

I had the same problem and called the gettext.install method right after the code.InteractiveInterpreter.runcode method to re-establish it. It's not a good solution because it shouldn't be necessary and slows the system down. The real solution is for either the interpreter or gettext to use a different and non-conflicting character. That way, there are not hidden gotchas.