summaryrefslogtreecommitdiffstats
path: root/share
diff options
context:
space:
mode:
authorJabier Arraiza Cenoz <jabier.arraiza@marker.es>2014-01-18 09:11:04 +0000
committerJabiertxof <jtx@jtx.marker.es>2014-01-18 09:11:04 +0000
commitf12d6a57fe5cc18be5afd164061578d8e00d75ce (patch)
tree7fd1a501a8a545fbf2326ead48cd041928699c5e /share
parentupdate to trunk (diff)
parentFix missing embeded image condition, kindly caught by suv in bug #1270334 (diff)
downloadinkscape-f12d6a57fe5cc18be5afd164061578d8e00d75ce.tar.gz
inkscape-f12d6a57fe5cc18be5afd164061578d8e00d75ce.zip
update to trunk
(bzr r11950.1.235)
Diffstat (limited to 'share')
-rwxr-xr-xshare/extensions/inkex.py28
-rw-r--r--share/palettes/README9
-rw-r--r--share/symbols/Makefile.am13
-rw-r--r--share/symbols/README6
-rwxr-xr-xshare/symbols/i18n.py16
-rw-r--r--share/templates/Makefile.am65
-rw-r--r--share/templates/README6
-rwxr-xr-xshare/templates/i18n.py20
8 files changed, 151 insertions, 12 deletions
diff --git a/share/extensions/inkex.py b/share/extensions/inkex.py
index 5333ef52b..1203a4606 100755
--- a/share/extensions/inkex.py
+++ b/share/extensions/inkex.py
@@ -151,15 +151,31 @@ class Effect:
"""Collect command line arguments"""
self.options, self.args = self.OptionParser.parse_args(args)
- def parse(self,file=None):
+ def parse(self, filename=None):
"""Parse document in specified file or on stdin"""
- try:
+
+ # First try to open the file from the function argument
+ if filename != None:
try:
- stream = open(file,'r')
- except:
- stream = open(self.svg_file,'r')
- except:
+ stream = open(filename, 'r')
+ except Exception:
+ errormsg(_("Unable to open specified file: %s") % filename)
+ sys.exit()
+
+ # If it wasn't specified, try to open the file specified as
+ # an object member
+ elif self.svg_file != None:
+ try:
+ stream = open(self.svg_file, 'r')
+ except Exception:
+ errormsg(_("Unable to open specified file: %s") % self.svg_file)
+ sys.exit()
+
+ # Finally, if the filename was not specified anywhere, use
+ # standard input stream
+ else:
stream = sys.stdin
+
p = etree.XMLParser(huge_tree=True)
self.document = etree.parse(stream, parser=p)
self.original_document = copy.deepcopy(self.document)
diff --git a/share/palettes/README b/share/palettes/README
index 8b04470b7..b6e7fd759 100644
--- a/share/palettes/README
+++ b/share/palettes/README
@@ -1,4 +1,11 @@
This is the directory with the Inkscape color palettes.
They are in Gimp format (.gpl). Within Inkscape, they
can be accessed by a drop-down menu in the Swatches
-dialog (Ctrl+Shift+W). \ No newline at end of file
+dialog (Ctrl+Shift+W).
+
+Internationalization
+
+This file is internationalized the same way as share/filters/filters/svg
+The i18n.py script called from the makefile will extract strings from the *.svg
+into a *.svg.h file. Intltool is then able to extracts these strings just like
+from normal .h files.
diff --git a/share/symbols/Makefile.am b/share/symbols/Makefile.am
index 5ddaac706..a7d21d2a8 100644
--- a/share/symbols/Makefile.am
+++ b/share/symbols/Makefile.am
@@ -2,7 +2,16 @@
symbolsdir = $(datadir)/inkscape/symbols
# Adding srcdir allows out-of-src builds to work
-symbols_DATA = $(wildcard $(srcdir)/*.svg)
+symbols_DATA = \
+ README \
+ $(wildcard $(srcdir)/*.svg) \
+ symbols.h
-EXTRA_DIST = $(symbols_DATA)
+symbols_i18n = $(wildcard $(srcdir)/*.svg)
+
+symbols.h: i18n.py $(symbols_i18n)
+ $(srcdir)/i18n.py $(symbols_i18n) > $(srcdir)/symbols.h
+
+EXTRA_DIST = $(symbols_DATA) \
+ i18n.py
diff --git a/share/symbols/README b/share/symbols/README
new file mode 100644
index 000000000..2d8ed144f
--- /dev/null
+++ b/share/symbols/README
@@ -0,0 +1,6 @@
+Internationalization
+
+This file is internationalized the same way as share/filters/filters/svg
+The i18n.py script called from the makefile will extract strings from the *.svg
+into a *.svg.h file. Intltool is then able to extracts these strings just like
+from normal .h files.
diff --git a/share/symbols/i18n.py b/share/symbols/i18n.py
new file mode 100755
index 000000000..db24059cd
--- /dev/null
+++ b/share/symbols/i18n.py
@@ -0,0 +1,16 @@
+#!/usr/bin/env python
+
+from xml.dom import minidom
+import sys
+
+sys.stdout.write("char * stringlst = [")
+
+for filename in sys.argv[1:]:
+ doc = minidom.parse(filename)
+ symbols = doc.getElementsByTagName('title')
+
+ if symbols:
+ for symbol in symbols:
+ sys.stdout.write("\n/* Symbols: " + filename + " */ NC_(\"Symbol\", \"" + symbol.firstChild.nodeValue + "\"),")
+
+sys.stdout.write("];")
diff --git a/share/templates/Makefile.am b/share/templates/Makefile.am
index 02acbfcf5..41c6a3f84 100644
--- a/share/templates/Makefile.am
+++ b/share/templates/Makefile.am
@@ -10,7 +10,7 @@ templates_DATA = \
business_card_85x54mm.svg \
business_card_90x50mm.svg \
CD_cover_300dpi.svg \
- CD_label_120x120.svg \
+ CD_label_120x120.svg \
DVD_cover_regular_300dpi.svg \
DVD_cover_slim_300dpi.svg \
DVD_cover_superslim_300dpi.svg \
@@ -30,7 +30,62 @@ templates_DATA = \
default.ja.svg \
default.lt.svg \
default.nl.svg \
- default.pl.svg \
+ default.pl.svg \
+ default.pt_BR.svg \
+ default.sk.svg \
+ default_mm.svg \
+ default_pt.svg \
+ desktop_1024x768.svg \
+ desktop_1600x1200.svg \
+ desktop_640x480.svg \
+ desktop_800x600.svg \
+ fontforge_glyph.svg \
+ icon_16x16.svg \
+ icon_32x32.svg \
+ icon_48x48.svg \
+ icon_64x64.svg \
+ Letter_landscape.svg \
+ Letter.svg \
+ no_borders.svg \
+ no_layers.svg \
+ video_HDTV_1920x1080.svg \
+ video_NTSC_720x486.svg \
+ video_PAL_720x576.svg \
+ web_banner_468x60.svg \
+ web_banner_728x90.svg \
+ LaTeX_Beamer.svg \
+ Typography_Canvas.svg \
+ templates.h
+
+templates_i18n = \
+ A4_landscape.svg \
+ A4.svg \
+ black_opaque.svg \
+ white_opaque.svg \
+ business_card_85x54mm.svg \
+ business_card_90x50mm.svg \
+ CD_cover_300dpi.svg \
+ CD_label_120x120.svg \
+ DVD_cover_regular_300dpi.svg \
+ DVD_cover_slim_300dpi.svg \
+ DVD_cover_superslim_300dpi.svg \
+ DVD_cover_ultraslim_300dpi.svg \
+ default.svg \
+ default.be.svg \
+ default.ca.svg \
+ default.cs.svg \
+ default.de.svg \
+ default.eo.svg \
+ default.eu.svg \
+ default.es.svg \
+ default.fi.svg \
+ default.fr.svg \
+ default.hu.svg \
+ default.it.svg \
+ default.ja.svg \
+ default.lt.svg \
+ default.nl.svg \
+ default.pl.svg \
default.pt_BR.svg \
default.sk.svg \
default_mm.svg \
@@ -56,5 +111,9 @@ templates_DATA = \
LaTeX_Beamer.svg \
Typography_Canvas.svg
+templates.h: i18n.py $(templates_i18n)
+ $(srcdir)/i18n.py $(foreach i,$(templates_i18n),$(srcdir)/$(i)) > $(srcdir)/templates.h
-EXTRA_DIST = $(templates_DATA)
+EXTRA_DIST = $(templates_DATA) \
+ i18n.py
+
diff --git a/share/templates/README b/share/templates/README
index c611da431..2959dd6a6 100644
--- a/share/templates/README
+++ b/share/templates/README
@@ -10,3 +10,9 @@ different languages. The default.svg itself is in English. These translations co
a translated name of the default layer and possibly different canvas size. Each
language version of Inkscape will only use one of these templates and ignore the rest.
+Internationalization
+
+This file is internationalized the same way as share/filters/filters/svg
+The i18n.py script called from the makefile will extract strings from the *.svg
+into a *.svg.h file. Intltool is then able to extracts these strings just like
+from normal .h files.
diff --git a/share/templates/i18n.py b/share/templates/i18n.py
new file mode 100755
index 000000000..6180d2546
--- /dev/null
+++ b/share/templates/i18n.py
@@ -0,0 +1,20 @@
+#!/usr/bin/env python
+
+from xml.dom import minidom
+import sys
+
+elements = ["inkscape:_name", "inkscape:_shortdesc", "inkscape:_keywords"]
+
+sys.stdout.write("char * stringlst = [")
+
+for filename in sys.argv[1:]:
+ doc = minidom.parse(filename)
+ templates = doc.getElementsByTagName('inkscape:_templateinfo')
+
+ if templates:
+ for element in elements:
+ lines = templates[0].getElementsByTagName(element)
+ if lines:
+ sys.stdout.write("N_(\"" + lines[0].firstChild.nodeValue + "\"),")
+
+sys.stdout.write("];")