2016-01-26 20:04:10 |
su_v |
description |
Messages in inkex.py marked for translation (with '_()') cause the script / extension to abort with 'NameError' unless the extension which imports inkex does run 'inkex.localize()' (currently, only extensions which themselves need gettext for translated messages do this).
Steps to reproduce:
1) apply attached diff to $PREFIX/share/inkscape/extensions/inkex.py
2) launch Inkscape 0.91 or trunk
3) apply an extension which runs 'inkex.localize()':
Extensions > Render > Alphabet Soup
--> success: renders and returns "This is a test" as expected
4) apply an extension which does not run 'inkex.localize()':
Extensions > Render > Gear > Gear
--> failure:
Traceback (most recent call last):
File "render_gears.py", line 184, in <module>
e.affect()
File "$PREFIX/share/inkscape_96ppi/extensions/inkex.py", line 267, in affect
self.parse()
File "$PREFIX/share/inkscape_96ppi/extensions/inkex.py", line 165, in parse
errormsg(_("This is a test"))
NameError: global name '_' is not defined
Possible workaround / fix:
Run 'localize()' early on in the definition of 'affect()' instead of delegating this to individual extensions?
Reproduced with Inkscape 0.91 and 0.91+devel r14615 on OS X 10.7.5. |
Messages in inkex.py marked for translation (with '_()') cause the script / extension to abort with 'NameError' unless the extension which imports inkex does run 'inkex.localize()' (currently, only extensions which themselves need gettext for translated messages do this).
Steps to reproduce:
1) apply attached diff to $PREFIX/share/inkscape/extensions/inkex.py
2) launch Inkscape 0.91 or trunk
3) apply an extension which runs 'inkex.localize()':
Extensions > Render > Alphabet Soup
--> success: renders and returns "This is a test" as expected
4) apply an extension which does not run 'inkex.localize()':
Extensions > Render > Gear > Gear
--> failure:
Traceback (most recent call last):
File "render_gears.py", line 184, in <module>
e.affect()
File "$PREFIX/share/inkscape/extensions/inkex.py", line 267, in affect
self.parse()
File "$PREFIX/share/inkscape/extensions/inkex.py", line 165, in parse
errormsg(_("This is a test"))
NameError: global name '_' is not defined
Possible workaround / fix:
Run 'localize()' early on in the definition of 'affect()' instead of delegating this to individual extensions?
Reproduced with Inkscape 0.91 and 0.91+devel r14615 on OS X 10.7.5. |
|