Commit c37bac56 authored by Nicolas Dufour's avatar Nicolas Dufour Committed by Nicolas Dufour

Translations. Fix for Bug #425202 (Script messages not translated).

(bzr r11749)
parent 27493025
......@@ -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)]
......
......@@ -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
......
......@@ -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
......
......@@ -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 *
......
......@@ -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()
......
......@@ -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={}
......
......@@ -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):
......
......@@ -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):
......
......@@ -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):
......
......@@ -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):
......
......@@ -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
......
......@@ -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))
......
......@@ -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):
'''
......
......@@ -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
......
......@@ -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):
......
......@@ -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):
......
......@@ -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):
......
......@@ -30,8 +30,8 @@ import os
import zipfile
import glob
import re
import gettext
_ = gettext.gettext
inkex.localize()
def propStrToDict(inStr):
dictio = {}
......
......@@ -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')
......
......@@ -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):
......
......@@ -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):
......
......@@ -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"):
......
......@@ -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):
......
......@@ -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):
......
......@@ -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 = []
......
#!/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):
......
......@@ -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):
......
......@@ -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:
......
......@@ -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...
......
......@@ -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=[]
......
......@@ -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