summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorLex Neva <github.com@lexneva.name>2018-08-20 15:49:19 -0400
committerLex Neva <github.com@lexneva.name>2018-08-20 15:56:29 -0400
commit871358d990d4a06b2eaaf0e405f2d18e26753d52 (patch)
tree700b6c2efea45e5e5aa69fb5e92285327227d7f2 /lib
parentf7f59efd7d5117c6b9b43b100df5fe646ea46bc3 (diff)
gettextify INX templates
Diffstat (limited to 'lib')
-rw-r--r--lib/commands.py28
-rw-r--r--lib/i18n.py5
-rwxr-xr-xlib/inx/extensions.py5
3 files changed, 23 insertions, 15 deletions
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(),