summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolas Dufour <nicoduf@yahoo.fr>2012-10-07 17:41:26 +0000
committerJazzyNico <nicoduf@yahoo.fr>2012-10-07 17:41:26 +0000
commitc37bac565d73ab069263873307286eb19641b99c (patch)
tree675dcc77a510aeeb6650328dff0fe80252010180
parentpowerstroke: arc extrapolate fix (diff)
downloadinkscape-c37bac565d73ab069263873307286eb19641b99c.tar.gz
inkscape-c37bac565d73ab069263873307286eb19641b99c.zip
Translations. Fix for Bug #425202 (Script messages not translated).
(bzr r11749)
-rwxr-xr-xshare/extensions/convert2dashes.py9
-rwxr-xr-xshare/extensions/dimension.py16
-rwxr-xr-xshare/extensions/draw_from_triangle.py13
-rwxr-xr-xshare/extensions/dxf_outlines.py14
-rwxr-xr-xshare/extensions/embedimage.py14
-rwxr-xr-xshare/extensions/export_gimp_palette.py12
-rwxr-xr-xshare/extensions/extractimage.py9
-rwxr-xr-xshare/extensions/funcplot.py10
-rwxr-xr-xshare/extensions/gcodetools.py14
-rwxr-xr-xshare/extensions/generate_voronoi.py14
-rwxr-xr-xshare/extensions/gimp_xcf.py7
-rwxr-xr-xshare/extensions/guides_creator.py14
-rwxr-xr-xshare/extensions/guillotine.py18
-rwxr-xr-xshare/extensions/inkex.py59
-rwxr-xr-xshare/extensions/interp_att_g.py12
-rwxr-xr-xshare/extensions/jessyInk_autoTexts.py3
-rwxr-xr-xshare/extensions/jessyInk_effects.py3
-rwxr-xr-xshare/extensions/jessyInk_export.py4
-rwxr-xr-xshare/extensions/jessyInk_keyBindings.py4
-rwxr-xr-xshare/extensions/jessyInk_masterSlide.py4
-rwxr-xr-xshare/extensions/jessyInk_mouseHandler.py4
-rwxr-xr-xshare/extensions/jessyInk_summary.py6
-rwxr-xr-xshare/extensions/jessyInk_transitions.py4
-rwxr-xr-xshare/extensions/jessyInk_video.py4
-rwxr-xr-xshare/extensions/jessyInk_view.py4
-rwxr-xr-xshare/extensions/launch_webbrowser.py7
-rwxr-xr-xshare/extensions/markers_strokepaint.py11
-rwxr-xr-xshare/extensions/pathalongpath.py19
-rwxr-xr-xshare/extensions/pathmodifier.py16
-rwxr-xr-xshare/extensions/pathscatter.py20
-rwxr-xr-xshare/extensions/perspective.py46
-rwxr-xr-xshare/extensions/polyhedron_3d.py15
-rwxr-xr-xshare/extensions/render_alphabetsoup.py17
-rwxr-xr-xshare/extensions/render_barcode_datamatrix.py8
-rwxr-xr-xshare/extensions/replace_font.py7
-rwxr-xr-xshare/extensions/summersnight.py7
-rwxr-xr-xshare/extensions/svg_and_media_zip_output.py11
-rwxr-xr-xshare/extensions/uniconv-ext.py15
-rwxr-xr-xshare/extensions/uniconv_output.py6
-rwxr-xr-xshare/extensions/voronoi2svg.py14
-rwxr-xr-xshare/extensions/web-set-att.py6
-rwxr-xr-xshare/extensions/web-transmit-att.py6
-rwxr-xr-xshare/extensions/webslicer_create_group.py5
-rwxr-xr-xshare/extensions/webslicer_create_rect.py5
-rwxr-xr-xshare/extensions/webslicer_export.py10
-rwxr-xr-xshare/extensions/wireframe_sphere.py12
-rw-r--r--src/main.cpp2
47 files changed, 318 insertions, 222 deletions
diff --git a/share/extensions/convert2dashes.py b/share/extensions/convert2dashes.py
index cf42a078a..9e7f6d439 100755
--- a/share/extensions/convert2dashes.py
+++ b/share/extensions/convert2dashes.py
@@ -20,10 +20,13 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
'''
+# local library
+import inkex
+import cubicsuperpath
+import bezmisc
+import simplestyle
-import inkex, cubicsuperpath, bezmisc, simplestyle
-import gettext
-_ = gettext.gettext
+inkex.localize()
def tpoint((x1,y1), (x2,y2), t = 0.5):
return [x1+t*(x2-x1),y1+t*(y2-y1)]
diff --git a/share/extensions/dimension.py b/share/extensions/dimension.py
index 9156fdc2c..4285effeb 100755
--- a/share/extensions/dimension.py
+++ b/share/extensions/dimension.py
@@ -32,16 +32,19 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
'''
-import sys, inkex, pathmodifier
-from simpletransform import *
-import gettext
-_ = gettext.gettext
-
+# standard library
+import sys
try:
from subprocess import Popen, PIPE
bsubprocess = True
except:
bsubprocess = False
+# local library
+import inkex
+import pathmodifier
+from simpletransform import *
+
+inkex.localize()
class Dimension(pathmodifier.PathModifier):
def __init__(self):
@@ -127,7 +130,8 @@ class Dimension(pathmodifier.PathModifier):
try:
testing_the_water = self.bbox[0]
except TypeError:
- sys.exit(_('Unable to process this object. Try changing it into a path first.'))
+ inkex.errormsg(_('Unable to process this object. Try changing it into a path first.'))
+ exit()
layer = self.current_layer
diff --git a/share/extensions/draw_from_triangle.py b/share/extensions/draw_from_triangle.py
index 124824528..414363e86 100755
--- a/share/extensions/draw_from_triangle.py
+++ b/share/extensions/draw_from_triangle.py
@@ -30,12 +30,15 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
'''
-
-import inkex
-import simplestyle, sys, simplepath
+# standard library
+import sys
from math import *
-import gettext
-_ = gettext.gettext
+# local library
+import inkex
+import simplestyle
+import simplepath
+
+inkex.localize()
#DRAWING ROUTINES
diff --git a/share/extensions/dxf_outlines.py b/share/extensions/dxf_outlines.py
index a5ff0f012..fd01e83e9 100755
--- a/share/extensions/dxf_outlines.py
+++ b/share/extensions/dxf_outlines.py
@@ -30,9 +30,17 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
'''
-import inkex, simplestyle, simpletransform, cubicsuperpath, coloreffect, dxf_templates, math
-import gettext
-_ = gettext.gettext
+# standard library
+import math
+# local library
+import inkex
+import simplestyle
+import simpletransform
+import cubicsuperpath
+import coloreffect
+import dxf_templates
+
+inkex.localize()
try:
from numpy import *
diff --git a/share/extensions/embedimage.py b/share/extensions/embedimage.py
index 882455cb0..159c3c152 100755
--- a/share/extensions/embedimage.py
+++ b/share/extensions/embedimage.py
@@ -16,10 +16,16 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
'''
+# standard library
+import base64
+import os
+import sys
+import urllib
+import urlparse
+# local library
+import inkex
-import inkex, os, base64, urlparse, urllib
-import gettext
-_ = gettext.gettext
+inkex.localize()
class Embedder(inkex.Effect):
def __init__(self):
@@ -74,7 +80,7 @@ class Embedder(inkex.Effect):
if (not os.path.isfile(path)):
inkex.errormsg(_('No xlink:href or sodipodi:absref attributes found, or they do not point to an existing file! Unable to embed image.'))
if path:
- inkex.errormsg(_("Sorry we could not locate %s") % path)
+ inkex.errormsg(_("Sorry we could not locate %s") % str(path))
if (os.path.isfile(path)):
file = open(path,"rb").read()
diff --git a/share/extensions/export_gimp_palette.py b/share/extensions/export_gimp_palette.py
index b9d6a1059..25856f4b4 100755
--- a/share/extensions/export_gimp_palette.py
+++ b/share/extensions/export_gimp_palette.py
@@ -7,11 +7,19 @@ Warranty: see above
DOCNAME='sodipodi:docname'
-import sys, simplestyle
+# standard library
+import sys
+# third party
try:
from xml.dom.minidom import parse
except:
- sys.exit(_('The export_gpl.py module requires PyXML. Please download the latest version from http://pyxml.sourceforge.net/.'))
+ inkex.errormsg(_('The export_gpl.py module requires PyXML. Please download the latest version from http://pyxml.sourceforge.net/.'))
+ sys.exit()
+# local library
+import inkex
+import simplestyle
+
+inkex.localize()
colortags=(u'fill',u'stroke',u'stop-color',u'flood-color',u'lighting-color')
colors={}
diff --git a/share/extensions/extractimage.py b/share/extensions/extractimage.py
index d5cf285c8..62dc83c87 100755
--- a/share/extensions/extractimage.py
+++ b/share/extensions/extractimage.py
@@ -16,10 +16,13 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
'''
+# standard library
+import base64
+import os
+# local library
+import inkex
-import inkex, base64, os
-import gettext
-_ = gettext.gettext
+inkex.localize()
class MyEffect(inkex.Effect):
def __init__(self):
diff --git a/share/extensions/funcplot.py b/share/extensions/funcplot.py
index a868e92a4..a3a810028 100755
--- a/share/extensions/funcplot.py
+++ b/share/extensions/funcplot.py
@@ -25,11 +25,15 @@ Changes:
* 21-Jun-2007: Tavmjong: Added polar coordinates
'''
-import inkex, simplepath, simplestyle
+# standard library
from math import *
from random import *
-import gettext
-_ = gettext.gettext
+# local library
+import inkex
+import simplepath
+import simplestyle
+
+inkex.localize()
def drawfunction(xstart, xend, ybottom, ytop, samples, width, height, left, bottom,
fx = "sin(x)", fpx = "cos(x)", fponum = True, times2pi = False, polar = False, isoscale = True, drawaxis = True, endpts = False):
diff --git a/share/extensions/gcodetools.py b/share/extensions/gcodetools.py
index e5f1944b0..ff0454db0 100755
--- a/share/extensions/gcodetools.py
+++ b/share/extensions/gcodetools.py
@@ -68,9 +68,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
gcodetools_current_version = "1.7"
-import inkex, simplestyle, simplepath
-import cubicsuperpath, simpletransform, bezmisc
-
+# standard library
import os
import math
import bezmisc
@@ -82,9 +80,15 @@ import cmath
import numpy
import codecs
import random
-import gettext
-_ = gettext.gettext
+# local library
+import inkex
+import simplestyle
+import simplepath
+import cubicsuperpath
+import simpletransform
+import bezmisc
+inkex.localize()
### Check if inkex has errormsg (0.46 version does not have one.) Could be removed later.
if "errormsg" not in dir(inkex):
diff --git a/share/extensions/generate_voronoi.py b/share/extensions/generate_voronoi.py
index 54400a90a..4ab67dcd6 100755
--- a/share/extensions/generate_voronoi.py
+++ b/share/extensions/generate_voronoi.py
@@ -20,14 +20,20 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
"""
-import random, inkex, simplestyle, gettext, voronoi
-_ = gettext.gettext
+# standard library
+import random
+# local library
+import inkex
+import simplestyle
+import voronoi
+
+inkex.localize()
try:
from subprocess import Popen, PIPE
except:
- inkex.errormsg(_("Failed to import the subprocess module. Please report this as a bug at : https://bugs.launchpad.net/inkscape."))
- inkex.errormsg("Python version is : " + str(inkex.sys.version_info))
+ inkex.errormsg(_("Failed to import the subprocess module. Please report this as a bug at: https://bugs.launchpad.net/inkscape."))
+ inkex.errormsg(_("Python version is: ") + str(inkex.sys.version_info))
exit()
def clip_line(x1, y1, x2, y2, w, h):
diff --git a/share/extensions/gimp_xcf.py b/share/extensions/gimp_xcf.py
index de3d67de6..ff1589cd8 100755
--- a/share/extensions/gimp_xcf.py
+++ b/share/extensions/gimp_xcf.py
@@ -18,17 +18,16 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
'''
-
-import gettext
+# standard library
import os
import shutil
from subprocess import Popen, PIPE
import sys
import tempfile
-
+# local library
import inkex
-_ = gettext.gettext
+inkex.localize()
# Define extension exceptions
class GimpXCFError(Exception): pass
diff --git a/share/extensions/guides_creator.py b/share/extensions/guides_creator.py
index 96f2557ee..e7458b81e 100755
--- a/share/extensions/guides_creator.py
+++ b/share/extensions/guides_creator.py
@@ -43,18 +43,16 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
import sys
sys.path.append('/usr/share/inkscape/extensions')
-# We will use the inkex module with the predefined Effect base class.
-import inkex
-from simplestyle import *
-
from xml.etree import ElementTree as ET
-
# for golden number formulae
from math import sqrt
-# for printing debugging output
-import gettext
-_ = gettext.gettext
+# We will use the inkex module with the predefined Effect base class.
+import inkex
+from simplestyle import *
+
+# for localized debugging output
+inkex.localize()
def printDebug(string):
inkex.errormsg(_(string))
diff --git a/share/extensions/guillotine.py b/share/extensions/guillotine.py
index bda56b206..82b1a5441 100755
--- a/share/extensions/guillotine.py
+++ b/share/extensions/guillotine.py
@@ -37,22 +37,22 @@ will export to:
etc.
'''
-
+# standard library
+import locale
import os
import sys
-import inkex
-import simplestyle
-import locale
-import gettext
-_ = gettext.gettext
-
-locale.setlocale(locale.LC_ALL, '')
-
try:
from subprocess import Popen, PIPE
bsubprocess = True
except:
bsubprocess = False
+# local library
+import inkex
+import simplestyle
+
+inkex.localize()
+
+locale.setlocale(locale.LC_ALL, '')
def float_sort(a, b):
'''
diff --git a/share/extensions/inkex.py b/share/extensions/inkex.py
index 6a29e3f64..f78a59a7c 100755
--- a/share/extensions/inkex.py
+++ b/share/extensions/inkex.py
@@ -33,25 +33,8 @@ import os
import random
import re
import sys
-
from math import *
-domain = 'inkscape'
-if sys.platform.startswith('win'):
- import locale
- current_locale, encoding = locale.getdefaultlocale()
- os.environ['LANG'] = current_locale
- try:
- localdir = os.environ['INKSCAPE_LOCALEDIR'];
- #sys.stderr.write(str(localdir) + "\n")
- gettext= gettext.translation(domain, localdir, [current_locale], fallback=True)
- except KeyError:
- gettext= gettext.translation(domain, fallback=True)
-else:
- gettext= gettext.translation(domain, fallback=True)
-
-_ = gettext.gettext
-
#a dictionary of all of the xmlns prefixes in a standard inkscape doc
NSS = {
u'sodipodi' :u'http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd',
@@ -65,6 +48,26 @@ u'xlink' :u'http://www.w3.org/1999/xlink',
u'xml' :u'http://www.w3.org/XML/1998/namespace'
}
+def localize():
+ domain = 'inkscape'
+ if sys.platform.startswith('win'):
+ import locale
+ current_locale, encoding = locale.getdefaultlocale()
+ os.environ['LANG'] = current_locale
+ try:
+ localdir = os.environ['INKSCAPE_LOCALEDIR'];
+ trans = gettext.translation(domain, localdir, [current_locale], fallback=True)
+ except KeyError:
+ trans = gettext.translation(domain, fallback=True)
+ else:
+ try:
+ localdir = os.environ['PACKAGE_LOCALE_DIR'];
+ trans = gettext.translation(domain, localdir, fallback=True)
+ except KeyError:
+ trans = gettext.translation(domain, fallback=True)
+ #sys.stderr.write(str(localdir) + "\n")
+ trans.install()
+
#a dictionary of unit to user unit conversion factors
uuconv = {'in':90.0, 'pt':1.25, 'px':1, 'mm':3.5433070866, 'cm':35.433070866, 'm':3543.3070866,
'km':3543307.0866, 'pc':15.0, 'yd':3240 , 'ft':1080}
@@ -89,12 +92,6 @@ def unittouu(string):
def uutounit(val, unit):
return val/uuconv[unit]
-try:
- from lxml import etree
-except Exception, e:
- sys.exit(_("The fantastic lxml wrapper for libxml2 is required by inkex.py and therefore this extension. Please download and install the latest version from http://cheeseshop.python.org/pypi/lxml/, or install it through your package manager by a command like: sudo apt-get install python-lxml\n\nTechnical details:\n%s" % (e,)))
-
-
def debug(what):
sys.stderr.write(str(what) + "\n")
return what
@@ -108,16 +105,24 @@ def errormsg(msg):
Note that this should always be combined with translation:
- import gettext
- _ = gettext.gettext
+ import inkex
+ inkex.localize()
...
inkex.errormsg(_("This extension requires two selected paths."))
"""
if isinstance(msg, unicode):
- sys.stderr.write(_(msg).encode("UTF-8") + "\n")
+ sys.stderr.write(msg.encode("UTF-8") + "\n")
else:
- sys.stderr.write((unicode(_(msg), "utf-8", errors='replace') + "\n").encode("UTF-8"))
+ sys.stderr.write((unicode(msg, "utf-8", errors='replace') + "\n").encode("UTF-8"))
+# third party library
+try:
+ from lxml import etree
+except Exception, e:
+ localize()
+ errormsg(_("The fantastic lxml wrapper for libxml2 is required by inkex.py and therefore this extension. Please download and install the latest version from http://cheeseshop.python.org/pypi/lxml/, or install it through your package manager by a command like: sudo apt-get install python-lxml\n\nTechnical details:\n%s" % (e,)))
+ sys.exit()
+
def check_inkbool(option, opt, value):
if str(value).capitalize() == 'True':
return True
diff --git a/share/extensions/interp_att_g.py b/share/extensions/interp_att_g.py
index 5f2b3574a..8ceaf8e34 100755
--- a/share/extensions/interp_att_g.py
+++ b/share/extensions/interp_att_g.py
@@ -16,9 +16,15 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
'''
-import inkex, simplestyle, math, re, string
-import gettext
-_ = gettext.gettext
+# standard library
+import math
+import re
+import string
+# local library
+import inkex
+import simplestyle
+
+inkex.localize()
class InterpAttG(inkex.Effect):
diff --git a/share/extensions/jessyInk_autoTexts.py b/share/extensions/jessyInk_autoTexts.py
index cf41ad24f..ed0edb6fa 100755
--- a/share/extensions/jessyInk_autoTexts.py
+++ b/share/extensions/jessyInk_autoTexts.py
@@ -25,8 +25,7 @@ sys.path.append('C:\Program Files\Inkscape\share\extensions')
# We will use the inkex module with the predefined Effect base class.
import inkex
-import gettext
-_ = gettext.gettext
+inkex.localize()
class JessyInk_AutoTexts(inkex.Effect):
def __init__(self):
diff --git a/share/extensions/jessyInk_effects.py b/share/extensions/jessyInk_effects.py
index 3af909bb2..e20e9fc2c 100755
--- a/share/extensions/jessyInk_effects.py
+++ b/share/extensions/jessyInk_effects.py
@@ -25,8 +25,7 @@ sys.path.append('C:\Program Files\Inkscape\share\extensions')
# We will use the inkex module with the predefined Effect base class.
import inkex
-import gettext
-_ = gettext.gettext
+inkex.localize()
class JessyInk_Effects(inkex.Effect):
def __init__(self):
diff --git a/share/extensions/jessyInk_export.py b/share/extensions/jessyInk_export.py
index 65247ab7e..71907e276 100755
--- a/share/extensions/jessyInk_export.py
+++ b/share/extensions/jessyInk_export.py
@@ -30,8 +30,8 @@ import os
import zipfile
import glob
import re
-import gettext
-_ = gettext.gettext
+
+inkex.localize()
def propStrToDict(inStr):
dictio = {}
diff --git a/share/extensions/jessyInk_keyBindings.py b/share/extensions/jessyInk_keyBindings.py
index 110ca3355..df50f4447 100755
--- a/share/extensions/jessyInk_keyBindings.py
+++ b/share/extensions/jessyInk_keyBindings.py
@@ -25,8 +25,8 @@ sys.path.append('C:\Program Files\Inkscape\share\extensions')
# We will use the inkex module with the predefined Effect base class.
import inkex
-import gettext
-_ = gettext.gettext
+
+inkex.localize()
class JessyInk_CustomKeyBindings(inkex.Effect):
modes = ('slide', 'index', 'drawing')
diff --git a/share/extensions/jessyInk_masterSlide.py b/share/extensions/jessyInk_masterSlide.py
index c29922d94..eca7711ff 100755
--- a/share/extensions/jessyInk_masterSlide.py
+++ b/share/extensions/jessyInk_masterSlide.py
@@ -25,8 +25,8 @@ sys.path.append('C:\Program Files\Inkscape\share\extensions')
# We will use the inkex module with the predefined Effect base class.
import inkex
-import gettext
-_ = gettext.gettext
+
+inkex.localize()
class JessyInk_MasterSlide(inkex.Effect):
def __init__(self):
diff --git a/share/extensions/jessyInk_mouseHandler.py b/share/extensions/jessyInk_mouseHandler.py
index 4eff4c467..fafc8eec3 100755
--- a/share/extensions/jessyInk_mouseHandler.py
+++ b/share/extensions/jessyInk_mouseHandler.py
@@ -27,8 +27,8 @@ sys.path.append('C:\Program Files\Inkscape\share\extensions')
# We will use the inkex module with the predefined Effect base class.
import inkex
-import gettext
-_ = gettext.gettext
+
+inkex.localize()
class JessyInk_CustomMouseHandler(inkex.Effect):
def __init__(self):
diff --git a/share/extensions/jessyInk_summary.py b/share/extensions/jessyInk_summary.py
index 48478c41e..feff79b37 100755
--- a/share/extensions/jessyInk_summary.py
+++ b/share/extensions/jessyInk_summary.py
@@ -25,8 +25,8 @@ sys.path.append('C:\Program Files\Inkscape\share\extensions')
# We will use the inkex module with the predefined Effect base class.
import inkex
-import gettext
-_ = gettext.gettext
+
+inkex.localize()
def propStrToList(str):
list = []
@@ -71,7 +71,7 @@ class JessyInk_Summary(inkex.Effect):
inkex.errormsg(_("JessyInk script installed."))
slides = []
- masterSlide = None
+ masterSlide = None
for node in self.document.xpath("//svg:g[@inkscape:groupmode='layer']", namespaces=inkex.NSS):
if node.get("{" + inkex.NSS["jessyink"] + "}masterSlide"):
diff --git a/share/extensions/jessyInk_transitions.py b/share/extensions/jessyInk_transitions.py
index 18cd3f880..bfd75584c 100755
--- a/share/extensions/jessyInk_transitions.py
+++ b/share/extensions/jessyInk_transitions.py
@@ -25,8 +25,8 @@ sys.path.append('C:\Program Files\Inkscape\share\extensions')
# We will use the inkex module with the predefined Effect base class.
import inkex
-import gettext
-_ = gettext.gettext
+
+inkex.localize()
class JessyInk_Transitions(inkex.Effect):
def __init__(self):
diff --git a/share/extensions/jessyInk_video.py b/share/extensions/jessyInk_video.py
index 51c73494b..bca98e9a7 100755
--- a/share/extensions/jessyInk_video.py
+++ b/share/extensions/jessyInk_video.py
@@ -29,8 +29,8 @@ import os
import re
from lxml import etree
from copy import deepcopy
-import gettext
-_ = gettext.gettext
+
+inkex.localize()
class JessyInk_Effects(inkex.Effect):
def __init__(self):
diff --git a/share/extensions/jessyInk_view.py b/share/extensions/jessyInk_view.py
index 04adc27ae..ee71a1d35 100755
--- a/share/extensions/jessyInk_view.py
+++ b/share/extensions/jessyInk_view.py
@@ -25,8 +25,8 @@ sys.path.append('C:\Program Files\Inkscape\share\extensions')
# We will use the inkex module with the predefined Effect base class.
import inkex
-import gettext
-_ = gettext.gettext
+
+inkex.localize()
def propStrToList(str):
list = []
diff --git a/share/extensions/launch_webbrowser.py b/share/extensions/launch_webbrowser.py
index 387d8b2cb..27a738e38 100755
--- a/share/extensions/launch_webbrowser.py
+++ b/share/extensions/launch_webbrowser.py
@@ -1,10 +1,11 @@
#!/usr/bin/env python
-import gettext
+# standard library
import webbrowser
import threading
from optparse import OptionParser
-
-_ = gettext.gettext
+# local library
+import inkex
+inkex.localize()
class VisitWebSiteWithoutLockingInkscape(threading.Thread):
def __init__(self):
diff --git a/share/extensions/markers_strokepaint.py b/share/extensions/markers_strokepaint.py
index 5c760cd17..d92716939 100755
--- a/share/extensions/markers_strokepaint.py
+++ b/share/extensions/markers_strokepaint.py
@@ -17,9 +17,14 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
'''
-import random, inkex, simplestyle, copy
-import gettext
-_ = gettext.gettext
+# standard library
+import random
+import copy
+# local library
+import inkex
+import simplestyle
+
+inkex.localize()
class MyEffect(inkex.Effect):
def __init__(self):
diff --git a/share/extensions/pathalongpath.py b/share/extensions/pathalongpath.py
index 71f389e1c..7da7f1797 100755
--- a/share/extensions/pathalongpath.py
+++ b/share/extensions/pathalongpath.py
@@ -30,12 +30,19 @@ as painted on these lines.
Now move and bend L to make it fit a skeleton, and see what happens to the normals:
they move and rotate, deforming the pattern.
'''
-
-import inkex, cubicsuperpath, bezmisc
-import pathmodifier,simpletransform
-import copy, math, re, random
-import gettext
-_ = gettext.gettext
+# standard library
+import copy
+import math
+import re
+import random
+# local library
+import inkex
+import cubicsuperpath
+import bezmisc
+import pathmodifier
+import simpletransform
+
+inkex.localize()
def flipxy(path):
for pathcomp in path:
diff --git a/share/extensions/pathmodifier.py b/share/extensions/pathmodifier.py
index ceb0994e6..ff2bbfb3a 100755
--- a/share/extensions/pathmodifier.py
+++ b/share/extensions/pathmodifier.py
@@ -27,11 +27,19 @@ to implement deformations of the form X=f(x,y), Y=g(x,y)...
TODO: Several handy functions are defined, that might in fact be of general
interest and that should be shipped out in separate files...
'''
-import inkex, cubicsuperpath, bezmisc, simplestyle
+# standard library
+import copy
+import math
+import re
+import random
+# local library
+import inkex
+import cubicsuperpath
+import bezmisc
+import simplestyle
from simpletransform import *
-import copy, math, re, random
-import gettext
-_ = gettext.gettext
+
+inkex.localize()
####################################################################
##-- zOrder computation...
diff --git a/share/extensions/pathscatter.py b/share/extensions/pathscatter.py
index 6ed3cc8ac..268e31069 100755
--- a/share/extensions/pathscatter.py
+++ b/share/extensions/pathscatter.py
@@ -30,13 +30,21 @@ as painted on these lines.
Now move and bend L to make it fit a skeleton, and see what happens to the normals:
they move and rotate, deforming the pattern.
'''
-
-import inkex, cubicsuperpath, bezmisc
-import pathmodifier, simpletransform
+# standard library
+import copy
+import math
+import re
+import random
+# third party
from lxml import etree
-import copy, math, re, random
-import gettext
-_ = gettext.gettext
+# local library
+import inkex
+import cubicsuperpath
+import bezmisc
+import pathmodifier
+import simpletransform
+
+inkex.localize()
def zSort(inNode,idList):
sortedList=[]
diff --git a/share/extensions/perspective.py b/share/extensions/perspective.py
index 733fb121a..8a0ffeb0b 100755
--- a/share/extensions/perspective.py
+++ b/share/extensions/perspective.py
@@ -18,10 +18,26 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Perspective approach & math by Dmitry Platonov, shadowjack@mail.ru, 2006
"""
-import sys, inkex, os, re, simplepath, cubicsuperpath, simpletransform, voronoi2svg
-import gettext
-_ = gettext.gettext
+# standard library
+import sys
+import os
+import re
+try:
+ from subprocess import Popen, PIPE
+ bsubprocess = True
+except:
+ bsubprocess = False
+# local library
+import inkex
+import simplepath
+import cubicsuperpath
+import simpletransform
+import voronoi2svg
from ffgeom import *
+
+inkex.localize()
+
+# third party
try:
from numpy import *
from numpy.linalg import *
@@ -29,30 +45,6 @@ except:
inkex.errormsg(_("Failed to import the numpy or numpy.linalg modules. These modules are required by this extension. Please install them and try again. On a Debian-like system this can be done with the command, sudo apt-get install python-numpy."))
exit()
-try:
- from subprocess import Popen, PIPE
- bsubprocess = True
-except:
- bsubprocess = False
-
-uuconv = {'in':90.0, 'pt':1.25, 'px':1, 'mm':3.5433070866, 'cm':35.433070866, 'pc':15.0}
-def unittouu(string):
- unit = re.compile('(%s)$' % '|'.join(uuconv.keys()))
- param = re.compile(r'(([-+]?[0-9]+(\.[0-9]*)?|[-+]?\.[0-9]+)([eE][-+]?[0-9]+)?)')
-
- p = param.match(string)
- u = unit.search(string)
- if p:
- retval = float(p.string[p.start():p.end()])
- else:
- retval = 0.0
- if u:
- try:
- return retval * uuconv[u.string[u.start():u.end()]]
- except KeyError:
- pass
- return retval
-
class Project(inkex.Effect):
def __init__(self):
inkex.Effect.__init__(self)
diff --git a/share/extensions/polyhedron_3d.py b/share/extensions/polyhedron_3d.py
index 1efce876f..063912cc2 100755
--- a/share/extensions/polyhedron_3d.py
+++ b/share/extensions/polyhedron_3d.py
@@ -48,12 +48,17 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
'''
-
-import inkex
-import simplestyle, sys, re
+# standard library
+import sys
+import re
from math import *
-import gettext
-_ = gettext.gettext
+# local library
+import inkex
+import simplestyle
+
+inkex.localize()
+
+# third party
try:
from numpy import *
except:
diff --git a/share/extensions/render_alphabetsoup.py b/share/extensions/render_alphabetsoup.py
index f682e9b57..ad43163e4 100755
--- a/share/extensions/render_alphabetsoup.py
+++ b/share/extensions/render_alphabetsoup.py
@@ -18,22 +18,23 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
'''
-
+# standard library
import copy
-import inkex
-import simplestyle
import math
import cmath
import string
import random
-import render_alphabetsoup_config
-import bezmisc
-import simplepath
import os
import sys
import re
-import gettext
-_ = gettext.gettext
+# local library
+import inkex
+import simplestyle
+import render_alphabetsoup_config
+import bezmisc
+import simplepath
+
+inkex.localize()
syntax = render_alphabetsoup_config.syntax
alphabet = render_alphabetsoup_config.alphabet
diff --git a/share/extensions/render_barcode_datamatrix.py b/share/extensions/render_barcode_datamatrix.py
index 20bcf94dc..2d28bb433 100755
--- a/share/extensions/render_barcode_datamatrix.py
+++ b/share/extensions/render_barcode_datamatrix.py
@@ -51,11 +51,11 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
0.50 2009-10-25 Full functionality, up to 144x144.
ASCII and compressed digit encoding only.
'''
+# local library
+import inkex
+import simplestyle
-import inkex, simplestyle
-
-import gettext
-_ = gettext.gettext
+inkex.localize()
symbols = {
'sq10': (10, 10),
diff --git a/share/extensions/replace_font.py b/share/extensions/replace_font.py
index f0f25ab8e..090920ced 100755
--- a/share/extensions/replace_font.py
+++ b/share/extensions/replace_font.py
@@ -27,13 +27,14 @@ font.
It can also replace all fonts indiscriminately, and list all fonts
currently being used.
'''
-
+# standard library
import os
import sys
+# local library
import inkex
import simplestyle
-import gettext
-_ = gettext.gettext
+
+inkex.localize()
text_tags = ['{http://www.w3.org/2000/svg}tspan',
'{http://www.w3.org/2000/svg}text',
diff --git a/share/extensions/summersnight.py b/share/extensions/summersnight.py
index 3bfa70cbd..aea5cea55 100755
--- a/share/extensions/summersnight.py
+++ b/share/extensions/summersnight.py
@@ -17,18 +17,17 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
"""
-import gettext
+# standard library
import os
-
+# local library
import cubicsuperpath
import inkex
import simplepath
import simpletransform
import voronoi2svg
-
from ffgeom import *
-_ = gettext.gettext
+inkex.localize()
try:
from subprocess import Popen, PIPE
diff --git a/share/extensions/svg_and_media_zip_output.py b/share/extensions/svg_and_media_zip_output.py
index 62e2b2ef5..20a5dac18 100755
--- a/share/extensions/svg_and_media_zip_output.py
+++ b/share/extensions/svg_and_media_zip_output.py
@@ -36,8 +36,7 @@ TODOs
- maybe add better extention
- consider switching to lzma in order to allow cross platform compression with no encoding problem...
'''
-
-import inkex
+# standard library
import urlparse
import urllib
import os, os.path
@@ -46,11 +45,13 @@ import zipfile
import shutil
import sys
import tempfile
-import simplestyle
-import gettext
import locale
+# local library
+import inkex
+import simplestyle
+
locale.setlocale(locale.LC_ALL, '')
-_ = gettext.gettext
+inkex.localize()
class CompressedMediaOutput(inkex.Effect):
def __init__(self):
diff --git a/share/extensions/uniconv-ext.py b/share/extensions/uniconv-ext.py
index 246340e89..5608000c4 100755
--- a/share/extensions/uniconv-ext.py
+++ b/share/extensions/uniconv-ext.py
@@ -20,14 +20,8 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
"""
-
+# standard library
import sys
-from run_command import run
-import gettext
-_ = gettext.gettext
-
-cmd = None
-
try:
from subprocess import Popen, PIPE
p = Popen('uniconvertor', shell=True, stdout=PIPE, stderr=PIPE).wait()
@@ -43,6 +37,13 @@ except ImportError:
if p!=32512 : cmd = 'uniconv'
p = Popen3('uniconvertor', True).wait()
if p!=32512 : cmd = 'uniconvertor'
+# local library
+from run_command import run
+import inkex
+
+cmd = None
+
+inkex.localize()
if cmd == None:
# there's no succeffully-returning uniconv command; try to get the module directly (on Windows)
diff --git a/share/extensions/uniconv_output.py b/share/extensions/uniconv_output.py
index 30d1c2fe0..93236483d 100755
--- a/share/extensions/uniconv_output.py
+++ b/share/extensions/uniconv_output.py
@@ -28,11 +28,13 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
# On failure, outputs an error message to stderr, and exits with a return
# code of 1.
+# standard library
import os
import sys
import tempfile
-import gettext
-_ = gettext.gettext
+# local library
+import inkex
+inkex.localize()
def run(command_format, prog_name, uniconv_format):
outfile = tempfile.mktemp(uniconv_format)
diff --git a/share/extensions/voronoi2svg.py b/share/extensions/voronoi2svg.py
index 7687bba91..dd693f8bb 100755
--- a/share/extensions/voronoi2svg.py
+++ b/share/extensions/voronoi2svg.py
@@ -27,11 +27,17 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
"""
-import sys, os
-import inkex, simplestyle, simplepath, simpletransform
+# standard library
+import sys
+import os
+# local library
+import inkex
+import simplestyle
+import simplepath
+import simpletransform
import voronoi
-import gettext
-_ = gettext.gettext
+
+inkex.localize()
class Point:
def __init__(self,x,y):
diff --git a/share/extensions/web-set-att.py b/share/extensions/web-set-att.py
index 65dd5a5b4..b224ed9aa 100755
--- a/share/extensions/web-set-att.py
+++ b/share/extensions/web-set-att.py
@@ -16,9 +16,11 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
'''
-import inkwebeffect, gettext
+# local library
+import inkwebeffect
+import inkex
-_ = gettext.gettext
+inkex.localize()
class InkWebTransmitAtt(inkwebeffect.InkWebEffect):
diff --git a/share/extensions/web-transmit-att.py b/share/extensions/web-transmit-att.py
index 35f16e145..414eb12ea 100755
--- a/share/extensions/web-transmit-att.py
+++ b/share/extensions/web-transmit-att.py
@@ -16,9 +16,11 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
'''
-import inkwebeffect, gettext
+# local library
+import inkwebeffect
+import inkex
-_ = gettext.gettext
+inkex.localize()
class InkWebTransmitAtt(inkwebeffect.InkWebEffect):
diff --git a/share/extensions/webslicer_create_group.py b/share/extensions/webslicer_create_group.py
index 613162850..dd48c3e96 100755
--- a/share/extensions/webslicer_create_group.py
+++ b/share/extensions/webslicer_create_group.py
@@ -16,12 +16,11 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
'''
-
+# local library
from webslicer_effect import *
import inkex
-import gettext
-_ = gettext.gettext
+inkex.localize()
class WebSlicer_CreateGroup(WebSlicer_Effect):
diff --git a/share/extensions/webslicer_create_rect.py b/share/extensions/webslicer_create_rect.py
index 9e916532f..7c04e8706 100755
--- a/share/extensions/webslicer_create_rect.py
+++ b/share/extensions/webslicer_create_rect.py
@@ -16,12 +16,11 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
'''
-
+# local library
from webslicer_effect import *
import inkex
-import gettext
-_ = gettext.gettext
+inkex.localize()
class WebSlicer_CreateRect(WebSlicer_Effect):
diff --git a/share/extensions/webslicer_export.py b/share/extensions/webslicer_export.py
index c50cbcc32..118dfbeee 100755
--- a/share/extensions/webslicer_export.py
+++ b/share/extensions/webslicer_export.py
@@ -16,15 +16,15 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
'''
-
-from webslicer_effect import *
-import inkex
-import gettext
+# standard library
import os
import sys
import tempfile
+# local library
+from webslicer_effect import *
+import inkex
-_ = gettext.gettext
+inkex.localize()
class WebSlicer_Export(WebSlicer_Effect):
diff --git a/share/extensions/wireframe_sphere.py b/share/extensions/wireframe_sphere.py
index 467aa609e..5804a1b45 100755
--- a/share/extensions/wireframe_sphere.py
+++ b/share/extensions/wireframe_sphere.py
@@ -54,13 +54,13 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Hidden lines of latitude still not properly calculated.
Prolate and oblate spheroids not considered.
'''
-
-import inkex, simplestyle
-
-import gettext
-_ = gettext.gettext
-
+# standard library
from math import *
+# local library
+import inkex
+import simplestyle
+
+inkex.localize()
#SVG OUTPUT FUNCTIONS ================================================
def draw_SVG_ellipse((rx, ry), (cx, cy), parent, start_end=(0,2*pi),transform='' ):
diff --git a/src/main.cpp b/src/main.cpp
index d1e087cac..578279929 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -625,6 +625,8 @@ main(int argc, char **argv)
bindtextdomain(GETTEXT_PACKAGE, BR_LOCALEDIR(""));
# else
bindtextdomain(GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
+ // needed by Python/Gettext
+ g_setenv("PACKAGE_LOCALE_DIR", PACKAGE_LOCALE_DIR, TRUE);
# endif
#endif