diff --git a/Makefile b/Makefile index a91eabe10..a7fd0e83f 100644 --- a/Makefile +++ b/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 diff --git a/lib/commands.py b/lib/commands.py index 5a471c2e3..214b5f404 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 d20f5d2f2..06e0dd498 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 ba206d8f6..2b0974408 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 cfe111bc8..0dcd185a2 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 \n" "Language-Team: LANGUAGE \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 d71b2081c..446e4b5c5 100644 --- a/templates/convert_to_satin.inx +++ b/templates/convert_to_satin.inx @@ -1,6 +1,6 @@ - <_name>Convert Line to Satin + {% trans %}Convert Line to Satin{% endtrans %} org.inkstitch.convert_to_satin inkstitch.py inkex.py @@ -8,7 +8,7 @@ all - +