kopia lustrzana https://github.com/inkstitch/inkstitch
gettextify INX templates
rodzic
f7f59efd7d
commit
871358d990
2
Makefile
2
Makefile
|
@ -32,7 +32,7 @@ inx:
|
|||
messages.po:
|
||||
rm -f messages.po
|
||||
bin/pyembroidery-gettext > pyembroidery-format-descriptions.py
|
||||
pybabel extract -o messages.po -F babel.conf --add-location=full --add-comments=l10n,L10n,L10N --sort-by-file --strip-comments .
|
||||
pybabel extract -o messages.po -F babel.conf --add-location=full --add-comments=l10n,L10n,L10N --sort-by-file --strip-comments -k N_ .
|
||||
rm pyembroidery-format-descriptions.py
|
||||
|
||||
.PHONY: locales
|
||||
|
|
|
@ -4,26 +4,26 @@ import cubicsuperpath
|
|||
from .svg import apply_transforms
|
||||
from .svg.tags import SVG_USE_TAG, SVG_SYMBOL_TAG, CONNECTION_START, CONNECTION_END, XLINK_HREF
|
||||
from .utils import cache
|
||||
from .i18n import _
|
||||
from .i18n import _, N_
|
||||
|
||||
COMMANDS = {
|
||||
# l10n: command attached to an object
|
||||
"fill_start": _("Fill stitch starting position"),
|
||||
# L10N command attached to an object
|
||||
"fill_start": N_("Fill stitch starting position"),
|
||||
|
||||
# l10n: command attached to an object
|
||||
"fill_end": _("Fill stitch ending position"),
|
||||
# L10N command attached to an object
|
||||
"fill_end": N_("Fill stitch ending position"),
|
||||
|
||||
# l10n: command attached to an object
|
||||
"stop": _("Stop (pause machine) after sewing this object"),
|
||||
# L10N command attached to an object
|
||||
"stop": N_("Stop (pause machine) after sewing this object"),
|
||||
|
||||
# l10n: command attached to an object
|
||||
"trim": _("Trim thread after sewing this object"),
|
||||
# L10N command attached to an object
|
||||
"trim": N_("Trim thread after sewing this object"),
|
||||
|
||||
# l10n: command attached to an object
|
||||
"ignore_object": _("Ignore this object (do not stitch)"),
|
||||
# L10N command attached to an object
|
||||
"ignore_object": N_("Ignore this object (do not stitch)"),
|
||||
|
||||
# l10n: command that affects entire layer
|
||||
"ignore_layer": _("Ignore layer (do not stitch any objects in this layer)")
|
||||
# L10N command that affects entire layer
|
||||
"ignore_layer": N_("Ignore layer (do not stitch any objects in this layer)")
|
||||
}
|
||||
|
||||
OBJECT_COMMANDS = [ "fill_start", "fill_end", "stop", "trim", "ignore_object" ]
|
||||
|
@ -117,7 +117,7 @@ class StandaloneCommand(BaseCommand):
|
|||
self.parse_symbol()
|
||||
|
||||
def get_command_description(command):
|
||||
return COMMANDS[command]
|
||||
return _(COMMANDS[command])
|
||||
|
||||
|
||||
def find_commands(node):
|
||||
|
|
|
@ -4,6 +4,11 @@ import gettext
|
|||
|
||||
_ = translation = None
|
||||
|
||||
# Use N_ to mark a string for translation but _not_ immediately translate it.
|
||||
# reference: https://docs.python.org/3/library/gettext.html#deferred-translations
|
||||
# Makefile configures pybabel to treat N_() the same as _()
|
||||
def N_(message): return message
|
||||
|
||||
def localize():
|
||||
if getattr(sys, 'frozen', False):
|
||||
# we are in a pyinstaller installation
|
||||
|
|
|
@ -2,7 +2,7 @@ import pyembroidery
|
|||
|
||||
from .utils import build_environment, write_inx_file
|
||||
from .outputs import pyembroidery_output_formats
|
||||
from ..extensions import extensions
|
||||
from ..extensions import extensions, Input, Output
|
||||
|
||||
|
||||
def pyembroidery_debug_formats():
|
||||
|
@ -15,6 +15,9 @@ def generate_extension_inx_files():
|
|||
env = build_environment()
|
||||
|
||||
for extension in extensions:
|
||||
if extension is Input or extension is Output:
|
||||
continue
|
||||
|
||||
name = extension.name()
|
||||
template = env.get_template('%s.inx' % name)
|
||||
write_inx_file(name, template.render(formats=pyembroidery_output_formats(),
|
||||
|
|
14
messages.po
14
messages.po
|
@ -8,7 +8,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: PROJECT VERSION\n"
|
||||
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
|
||||
"POT-Creation-Date: 2018-08-20 15:17-0400\n"
|
||||
"POT-Creation-Date: 2018-08-20 15:49-0400\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
|
@ -17,32 +17,32 @@ msgstr ""
|
|||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Generated-By: Babel 2.5.3\n"
|
||||
|
||||
#. : command attached to an object
|
||||
#. command attached to an object
|
||||
#: lib/commands.py:11
|
||||
msgid "Fill stitch starting position"
|
||||
msgstr ""
|
||||
|
||||
#. : command attached to an object
|
||||
#. command attached to an object
|
||||
#: lib/commands.py:14
|
||||
msgid "Fill stitch ending position"
|
||||
msgstr ""
|
||||
|
||||
#. : command attached to an object
|
||||
#. command attached to an object
|
||||
#: lib/commands.py:17
|
||||
msgid "Stop (pause machine) after sewing this object"
|
||||
msgstr ""
|
||||
|
||||
#. : command attached to an object
|
||||
#. command attached to an object
|
||||
#: lib/commands.py:20
|
||||
msgid "Trim thread after sewing this object"
|
||||
msgstr ""
|
||||
|
||||
#. : command attached to an object
|
||||
#. command attached to an object
|
||||
#: lib/commands.py:23
|
||||
msgid "Ignore this object (do not stitch)"
|
||||
msgstr ""
|
||||
|
||||
#. : command that affects entire layer
|
||||
#. command that affects entire layer
|
||||
#: lib/commands.py:26
|
||||
msgid "Ignore layer (do not stitch any objects in this layer)"
|
||||
msgstr ""
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension">
|
||||
<_name>Convert Line to Satin</_name>
|
||||
<name>{% trans %}Convert Line to Satin{% endtrans %}</name>
|
||||
<id>org.inkstitch.convert_to_satin</id>
|
||||
<dependency type="executable" location="extensions">inkstitch.py</dependency>
|
||||
<dependency type="executable" location="extensions">inkex.py</dependency>
|
||||
|
@ -8,7 +8,7 @@
|
|||
<effect>
|
||||
<object-type>all</object-type>
|
||||
<effects-menu>
|
||||
<submenu _name="Embroidery" />
|
||||
<submenu name="Ink/Stitch" />
|
||||
</effects-menu>
|
||||
</effect>
|
||||
<script>
|
||||
|
|
|
@ -1,25 +1,25 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension">
|
||||
<_name>Embroider</_name>
|
||||
<id>jonh.embroider</id>
|
||||
<name>{% trans %}Embroider{% endtrans %}</name>
|
||||
<id>org.inkstitch.embroider</id>
|
||||
<dependency type="executable" location="extensions">inkstitch.py</dependency>
|
||||
<dependency type="executable" location="extensions">inkex.py</dependency>
|
||||
<param name="collapse_len_mm" type="float" min="0.0" max="10.0" _gui-text="Collapse length (mm)" _gui-description="Jump stitches smaller than this will be treated as normal stitches.">3.0</param>
|
||||
<param name="hide_layers" type="boolean" _gui-text="Hide other layers" _gui-description="Hide all other top-level layers when the embroidery layer is generated, in order to make stitching discernable.">true</param>
|
||||
<param name="output_format" type="optiongroup" _gui-text="Output file format" appearance="minimal">
|
||||
<param name="collapse_len_mm" type="float" min="0.0" max="10.0" gui-text="{% trans %}Collapse length (mm){% endtrans %}" gui-description="{% trans %}Jump stitches smaller than this will be treated as normal stitches.{% endtrans %}">3.0</param>
|
||||
<param name="hide_layers" type="boolean" gui-text="{% trans %}Hide other layers{% endtrans %}" gui-description="{% trans %}Hide all other top-level layers when the embroidery layer is generated, in order to make stitching discernible.{% endtrans %}">true</param>
|
||||
<param name="output_format" type="optiongroup" gui-text="{% trans %}Output file format{% endtrans %}" appearance="minimal">
|
||||
{% for format, description in formats %}
|
||||
<_option value="{{ format }}">{{ description }} ({{ format | upper }})</_option>
|
||||
<_option value="{{ format }}">{{ _(description) }} ({{ format | upper }})</_option>
|
||||
{% endfor %}
|
||||
{% for format, description in debug_formats %}
|
||||
<_option value="{{ format }}">{{ description }} ({{ format | upper }}) [DEBUG]</_option>
|
||||
<_option value="{{ format }}">{{ _(description) }} ({{ format | upper }}) [{{ _("DEBUG") }}]</_option>
|
||||
{% endfor %}
|
||||
</param>
|
||||
<param name="path" type="string" _gui-text="Directory" _gui-description="Leave empty to save the output in Inkscape's extension directory."></param>
|
||||
<param name="path" type="string" gui-text="{% trans %}Directory{% endtrans %}" gui-description="{% trans %}Leave empty to save the output in Inkscape's extension directory.{% endtrans %}"></param>
|
||||
<param name="extension" type="string" gui-hidden="true">embroider</param>
|
||||
<effect>
|
||||
<object-type>all</object-type>
|
||||
<effects-menu>
|
||||
<submenu _name="Embroidery"/>
|
||||
<submenu name="Ink/Stitch"/>
|
||||
</effects-menu>
|
||||
</effect>
|
||||
<script>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension">
|
||||
<_name>Flip Satin Columns</_name>
|
||||
<name>{% trans %}Flip Satin Columns{% endtrans %}</name>
|
||||
<id>org.inkstitch.flip_satins</id>
|
||||
<dependency type="executable" location="extensions">inkstitch.py</dependency>
|
||||
<dependency type="executable" location="extensions">inkex.py</dependency>
|
||||
|
@ -8,7 +8,7 @@
|
|||
<effect>
|
||||
<object-type>all</object-type>
|
||||
<effects-menu>
|
||||
<submenu _name="Embroidery"/>
|
||||
<submenu name="Ink/Stitch"/>
|
||||
</effects-menu>
|
||||
</effect>
|
||||
<script>
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension">
|
||||
<_name>{{ format | upper }} file input</_name>
|
||||
<name>{{ format | upper }} file input</name>
|
||||
<id>org.inkstitch.input.{{ format }}</id>
|
||||
<dependency type="executable" location="extensions">inkstitch.py</dependency>
|
||||
<dependency type="executable" location="extensions">inkex.py</dependency>
|
||||
<input>
|
||||
<extension>.{{ format }}</extension>
|
||||
<mimetype>application/x-embroidery-{{ format }}</mimetype>
|
||||
<_filetypename>Ink/Stitch: {{ description }} (.{{ format }})</_filetypename>
|
||||
<_filetypetooltip>convert {{ format | upper }} file to Ink/Stitch manual-stitch paths</_filetypetooltip>
|
||||
<_filetypename>Ink/Stitch: {{ _(description) }} (.{{ format }})</_filetypename>
|
||||
<_filetypetooltip>{{ _("convert %(file_extension)s file to Ink/Stitch manual-stitch paths") % dict(file_extension=format.upper()) }}</_filetypetooltip>
|
||||
</input>
|
||||
<param name="extension" type="string" gui-hidden="true">input</param>
|
||||
<script>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension">
|
||||
<_name>Install add-ons for Inkscape</_name>
|
||||
<name>{% trans %}Install add-ons for Inkscape{% endtrans %}</name>
|
||||
<id>org.inkstitch.install</id>
|
||||
<dependency type="executable" location="extensions">inkstitch.py</dependency>
|
||||
<dependency type="executable" location="extensions">inkex.py</dependency>
|
||||
|
@ -8,7 +8,7 @@
|
|||
<effect>
|
||||
<object-type>all</object-type>
|
||||
<effects-menu>
|
||||
<submenu _name="Embroidery"/>
|
||||
<submenu name="Ink/Stitch"/>
|
||||
</effects-menu>
|
||||
</effect>
|
||||
<script>
|
||||
|
|
|
@ -1,16 +1,18 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension">
|
||||
<_name>Add Layer Commands</_name>
|
||||
<name>{% trans %}Add Layer Commands{% endtrans %}</name>
|
||||
<id>org.inkstitch.layer_commands</id>
|
||||
<dependency type="executable" location="extensions">inkstitch.py</dependency>
|
||||
<dependency type="executable" location="extensions">inkex.py</dependency>
|
||||
<param name="description" type="description">Commands will be added to the currently-selected layer.</param>
|
||||
<param name="ignore_layer" type="boolean" _gui-text="Ignore layer (do not stitch any objects in this layer)">false</param>
|
||||
<param name="description" type="description">{% trans %}Commands will be added to the currently-selected layer.{% endtrans %}</param>
|
||||
{% for command, description in layer_commands %}
|
||||
<param name="{{ command }}" type="boolean" gui-text="{{ _(description) }}">false</param>
|
||||
{% endfor %}
|
||||
<param name="extension" type="string" gui-hidden="true">layer_commands</param>
|
||||
<effect>
|
||||
<object-type>all</object-type>
|
||||
<effects-menu>
|
||||
<submenu _name="Embroidery" />
|
||||
<submenu name="Ink/Stitch" />
|
||||
</effects-menu>
|
||||
</effect>
|
||||
<script>
|
||||
|
|
|
@ -1,19 +1,16 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension">
|
||||
<_name>Attach Commands</_name>
|
||||
<name>{% trans %}Attach Commands{% endtrans %}</name>
|
||||
<id>org.inkstitch.commands</id>
|
||||
<dependency type="executable" location="extensions">inkstitch.py</dependency>
|
||||
<dependency type="executable" location="extensions">inkex.py</dependency>
|
||||
<param name="fill_start" type="boolean" _gui-text="Fill stitch starting position">false</param>
|
||||
<param name="fill_end" type="boolean" _gui-text="Fill stitch ending position">false</param>
|
||||
<param name="stop" type="boolean" _gui-text="Stop after sewing this object">false</param>
|
||||
<param name="trim" type="boolean" _gui-text="Trim thread after sewing this object">false</param>
|
||||
<param name="ignore_object" type="boolean" _gui-text="Ignore this object (do not stitch)">false</param>
|
||||
<param name="extension" type="string" gui-hidden="true">object_commands</param>
|
||||
{% for command, description in object_commands %}
|
||||
<param name="{{ object }}" type="boolean" gui-text="{{ _(description ) }}">false</param>
|
||||
{% endfor %}
|
||||
<effect>
|
||||
<object-type>all</object-type>
|
||||
<effects-menu>
|
||||
<submenu _name="Embroidery" />
|
||||
<submenu name="Ink/Stitch" />
|
||||
</effects-menu>
|
||||
</effect>
|
||||
<script>
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension">
|
||||
<_name>{{ format | upper }} file output</_name>
|
||||
<name>{{ format | upper }} file output</name>
|
||||
<id>org.inkstitch.output.{{ format }}</id>
|
||||
<dependency type="executable" location="extensions">inkstitch.py</dependency>
|
||||
<dependency type="executable" location="extensions">inkex.py</dependency>
|
||||
<output>
|
||||
<extension>.{{ format }}</extension>
|
||||
<mimetype>application/x-embroidery-{{ format }}</mimetype>
|
||||
<_filetypename>Ink/Stitch: {{ description }} (.{{ format }})</_filetypename>
|
||||
<_filetypetooltip>Save design in {{ format | upper }} format using Ink/Stitch</_filetypetooltip>
|
||||
<_filetypename>Ink/Stitch: {{ _(description) }} (.{{ format }})</_filetypename>
|
||||
<_filetypetooltip>{{ _("Save design in %(file_extension)s format using Ink/Stitch") % dict(file_extension=format.upper()) }}</_filetypetooltip>
|
||||
<dataloss>true</dataloss>
|
||||
</output>
|
||||
<param name="extension" type="string" gui-hidden="true">output</param>
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension">
|
||||
<_name>Params</_name>
|
||||
<id>jonh.embroider.params</id>
|
||||
<name>{% trans %}Params{% endtrans %}</name>
|
||||
<id>org.inkstitch.params</id>
|
||||
<dependency type="executable" location="extensions">inkstitch.py</dependency>
|
||||
<dependency type="executable" location="extensions">inkex.py</dependency>
|
||||
<param name="extension" type="string" gui-hidden="true">params</param>
|
||||
<effect>
|
||||
<object-type>all</object-type>
|
||||
<effects-menu>
|
||||
<submenu _name="Embroidery"/>
|
||||
<submenu name="Ink/Stitch"/>
|
||||
</effects-menu>
|
||||
</effect>
|
||||
<script>
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension">
|
||||
<_name>Print</_name>
|
||||
<id>jonh.embroider.print</id>
|
||||
<name>{% trans %}Print{% endtrans %}</name>
|
||||
<id>org.inkstitch.print</id>
|
||||
<dependency type="executable" location="extensions">inkstitch.py</dependency>
|
||||
<dependency type="executable" location="extensions">inkex.py</dependency>
|
||||
<param name="extension" type="string" gui-hidden="true">print</param>
|
||||
<effect>
|
||||
<object-type>all</object-type>
|
||||
<effects-menu>
|
||||
<submenu _name="Embroidery"/>
|
||||
<submenu name="Ink/Stitch"/>
|
||||
</effects-menu>
|
||||
</effect>
|
||||
<script>
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension">
|
||||
<_name>Simulate</_name>
|
||||
<id>jonh.embroider.simulate</id>
|
||||
<name>{% trans %}Simulate{% endtrans %}</name>
|
||||
<id>org.inkstitch.simulate</id>
|
||||
<dependency type="executable" location="extensions">inkstitch.py</dependency>
|
||||
<dependency type="executable" location="extensions">inkex.py</dependency>
|
||||
<param name="extension" type="string" gui-hidden="true">simulate</param>
|
||||
<effect>
|
||||
<object-type>all</object-type>
|
||||
<effects-menu>
|
||||
<submenu _name="Embroidery"/>
|
||||
<submenu name="Ink/Stitch"/>
|
||||
</effects-menu>
|
||||
</effect>
|
||||
<script>
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension">
|
||||
<_name>embroidery ZIP file output</_name>
|
||||
<name>embroidery ZIP file output</name>
|
||||
<id>org.inkstitch.output.zip</id>
|
||||
<dependency type="executable" location="extensions">inkstitch.py</dependency>
|
||||
<dependency type="executable" location="extensions">inkex.py</dependency>
|
||||
<output>
|
||||
<extension>.zip</extension>
|
||||
<mimetype>application/zip</mimetype>
|
||||
<_filetypename>Ink/Stitch: ZIP export multiple formats (.zip)</_filetypename>
|
||||
<_filetypetooltip>Create a ZIP with multiple embroidery file formats using Ink/Stitch</_filetypetooltip>
|
||||
<_filetypename>{{ _("Ink/Stitch: ZIP export multiple formats (.zip)") }}"</_filetypename>
|
||||
<_filetypetooltip>{{ _("Create a ZIP with multiple embroidery file formats using Ink/Stitch") }}</_filetypetooltip>
|
||||
<dataloss>true</dataloss>
|
||||
</output>
|
||||
{% for format, description in formats %}
|
||||
<param name="format-{{ format }}" type="boolean" _gui-text=".{{ format | upper }}: {{ description }}">false</param>
|
||||
<param name="format-{{ format }}" type="boolean" gui-text=".{{ format | upper }}: {{ _(description) }}">false</param>
|
||||
{% endfor %}
|
||||
<param name="extension" type="string" gui-hidden="true">zip</param>
|
||||
<script>
|
||||
|
|
Ładowanie…
Reference in New Issue