diff options
| -rw-r--r-- | Makefile | 2 | ||||
| -rw-r--r-- | lib/commands.py | 28 | ||||
| -rw-r--r-- | lib/i18n.py | 5 | ||||
| -rwxr-xr-x | lib/inx/extensions.py | 5 | ||||
| -rw-r--r-- | messages.po | 14 | ||||
| -rw-r--r-- | templates/convert_to_satin.inx | 4 | ||||
| -rw-r--r-- | templates/embroider.inx | 18 | ||||
| -rw-r--r-- | templates/flip.inx | 4 | ||||
| -rw-r--r-- | templates/input.inx | 6 | ||||
| -rw-r--r-- | templates/install.inx | 4 | ||||
| -rw-r--r-- | templates/layer_commands.inx | 10 | ||||
| -rw-r--r-- | templates/object_commands.inx | 13 | ||||
| -rw-r--r-- | templates/output.inx | 6 | ||||
| -rw-r--r-- | templates/params.inx | 6 | ||||
| -rw-r--r-- | templates/print.inx | 6 | ||||
| -rw-r--r-- | templates/simulate.inx | 6 | ||||
| -rw-r--r-- | templates/zip.inx | 8 |
17 files changed, 76 insertions, 69 deletions
@@ -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 diff --git a/lib/commands.py b/lib/commands.py index 5a471c2e..214b5f40 100644 --- a/lib/commands.py +++ b/lib/commands.py @@ -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): diff --git a/lib/i18n.py b/lib/i18n.py index d20f5d2f..06e0dd49 100644 --- a/lib/i18n.py +++ b/lib/i18n.py @@ -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 diff --git a/lib/inx/extensions.py b/lib/inx/extensions.py index ba206d8f..2b097440 100755 --- a/lib/inx/extensions.py +++ b/lib/inx/extensions.py @@ -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(), diff --git a/messages.po b/messages.po index cfe111bc..0dcd185a 100644 --- a/messages.po +++ b/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 "" diff --git a/templates/convert_to_satin.inx b/templates/convert_to_satin.inx index d71b2081..446e4b5c 100644 --- a/templates/convert_to_satin.inx +++ b/templates/convert_to_satin.inx @@ -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> diff --git a/templates/embroider.inx b/templates/embroider.inx index 7c6544db..f4a78d73 100644 --- a/templates/embroider.inx +++ b/templates/embroider.inx @@ -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> diff --git a/templates/flip.inx b/templates/flip.inx index f129b8d9..6ce7c6ef 100644 --- a/templates/flip.inx +++ b/templates/flip.inx @@ -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> diff --git a/templates/input.inx b/templates/input.inx index 15ccdef8..1e50d841 100644 --- a/templates/input.inx +++ b/templates/input.inx @@ -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> diff --git a/templates/install.inx b/templates/install.inx index 7275e13a..9ee020fe 100644 --- a/templates/install.inx +++ b/templates/install.inx @@ -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> diff --git a/templates/layer_commands.inx b/templates/layer_commands.inx index 7eadd094..e04d2540 100644 --- a/templates/layer_commands.inx +++ b/templates/layer_commands.inx @@ -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> diff --git a/templates/object_commands.inx b/templates/object_commands.inx index bba8602b..71f9d0b3 100644 --- a/templates/object_commands.inx +++ b/templates/object_commands.inx @@ -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> diff --git a/templates/output.inx b/templates/output.inx index 4f971fb3..b517ea70 100644 --- a/templates/output.inx +++ b/templates/output.inx @@ -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> diff --git a/templates/params.inx b/templates/params.inx index 7b3b4e63..2397be8e 100644 --- a/templates/params.inx +++ b/templates/params.inx @@ -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> diff --git a/templates/print.inx b/templates/print.inx index edc96a4c..2670d30e 100644 --- a/templates/print.inx +++ b/templates/print.inx @@ -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> diff --git a/templates/simulate.inx b/templates/simulate.inx index 66f892d8..7a0174a3 100644 --- a/templates/simulate.inx +++ b/templates/simulate.inx @@ -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> diff --git a/templates/zip.inx b/templates/zip.inx index c85e849f..9af05ab9 100644 --- a/templates/zip.inx +++ b/templates/zip.inx @@ -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> |
