diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 2445dc0dc..ba2948652 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -8,7 +8,7 @@ on:
- "v*"
jobs:
linux:
- runs-on: ubuntu-16.04
+ runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
with:
@@ -24,9 +24,9 @@ jobs:
id: pip-cache
with:
path: ~/.cache/pip
- key: ${{ runner.os }}-16.04-pip-${{ hashFiles('**/requirements.txt') }}
+ key: ${{ runner.os }}-18.04-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
- ${{ runner.os }}-16.04-pip-
+ ${{ runner.os }}-18.04-pip-
- name: Get yarn cache directory path
id: yarn-cache-dir-path
diff --git a/Makefile b/Makefile
index e7fcf2dfe..b76c76de4 100644
--- a/Makefile
+++ b/Makefile
@@ -15,13 +15,14 @@ inx: version locales
.PHONY: messages.po
messages.po:
rm -f messages.po
+ xgettext inx/*.inx --its=its/inx.its -o messages-inx.po
bin/pyembroidery-gettext > pyembroidery-format-descriptions.py
bin/inkstitch-fonts-gettext > inkstitch-fonts-metadata.py
pybabel extract -o messages-babel.po -F babel.conf --add-location=full --add-comments=l10n,L10n,L10N --sort-by-file --strip-comments -k N_ -k '$$gettext' .
rm pyembroidery-format-descriptions.py inkstitch-fonts-metadata.py
cd electron && yarn --link-duplicates --pure-lockfile
find electron/src -name '*.html' -o -name '*.js' -o -name '*.vue' | xargs electron/node_modules/.bin/gettext-extract --quiet --attribute v-translate --output messages-vue.po
- msgcat -o messages.po messages-babel.po messages-vue.po
+ msgcat -o messages.po messages-babel.po messages-vue.po messages-inx.po
electron/src/renderer/assets/translations.json: $(wildcard translations/messages_*.po)
find translations -name '*.po' -a ! -empty | \
@@ -36,18 +37,7 @@ clean:
.PHONY: locales
locales:
- # message files will look like this:
- # translations/messages_en_US.po
- if ls translations/*.po > /dev/null 2>&1; then \
- for po in translations/*.po; do \
- lang=$${po%.*}; \
- lang=$${lang#*_}; \
- mkdir -p locales/$$lang/LC_MESSAGES/; \
- msgfmt $$po -o locales/$$lang/LC_MESSAGES/inkstitch.mo; \
- done; \
- else \
- mkdir -p locales; \
- fi
+ bash bin/generate-translation-files
.PHONY: version
version:
diff --git a/bin/build-distribution-archives b/bin/build-distribution-archives
index 6402122b8..68dd46cf8 100755
--- a/bin/build-distribution-archives
+++ b/bin/build-distribution-archives
@@ -5,30 +5,23 @@ OS="${BUILD:-$(uname)}"
ARCH="$(uname -m)"
if [ "$BUILD" = "osx" ]; then
- cp -a images/examples palettes symbols fonts LICENSE VERSION dist/inkstitch.app/Contents
+ cp -a images/examples palettes symbols fonts inx LICENSE VERSION dist/inkstitch.app/Contents
cp -a icons locales print dist/inkstitch.app/Contents/MacOS
cp -a electron/build/mac dist/inkstitch.app/Contents/electron
rm -rf dist/inkstitch/
else
- cp -a images/examples palettes symbols fonts LICENSE VERSION dist/inkstitch
+ cp -a images/examples palettes symbols fonts inx LICENSE VERSION dist/inkstitch
cp -a icons locales print dist/inkstitch/bin
cp -a electron/build/*-unpacked dist/inkstitch/electron
fi
mkdir artifacts
+cd dist
-for d in inx/*; do
- lang=${d%.*}
- lang=${lang#*/}
- cp $d/*.inx dist
-
- cd dist
- if [ "$BUILD" = "windows" ]; then
- # The python zipfile command line utility can't handle directories
- # containing files with UTF-8 names on Windows, so we use 7-zip instead.
- 7z a ../artifacts/inkstitch-${VERSION}-${OS}-${lang}.zip *
- else
- python -m zipfile -c ../artifacts/inkstitch-${VERSION}-${OS}-${lang}.zip *
- fi
- cd ..
-done
+if [ "$$BUILD" = "windows" ]; then
+ # The python zipfile command line utility can't handle directories
+ # containing files with UTF-8 names on Windows, so we use 7-zip instead.
+ 7z a ../artifacts/inkstitch-${VERSION}-${OS}.zip *;
+else
+ python -m zipfile -c ../artifacts/inkstitch-${VERSION}-${OS}.zip *;
+fi
diff --git a/bin/generate-translation-files b/bin/generate-translation-files
new file mode 100644
index 000000000..c1f77a30d
--- /dev/null
+++ b/bin/generate-translation-files
@@ -0,0 +1,27 @@
+#!/bin/bash
+
+# message files will look like this:
+# translations/messages_en_US.po
+if ls translations/*.po > /dev/null 2>&1; then
+ for po in translations/*.po; do
+ lang=${po%.*};
+ lang=${lang#*_};
+ mkdir -p locales/$lang/LC_MESSAGES/;
+ msgfmt $po -o locales/$lang/LC_MESSAGES/inkstitch.mo;
+ done;
+else
+ mkdir -p locales;
+fi;
+
+# copy locales also into the inx folder, inkscape needs
+# them to be in exactly that place
+mkdir -p inx;
+cp -r locales/ inx/locale/;
+# for some reason inkscape requires the language folder names
+# as a two letter code ("en" instead of "en_US")
+cd inx/locale;
+for language in */; do
+ if [ ! -d ${language:0:2} ]; then
+ mv -- $language ${language:0:2};
+ fi;
+done;
diff --git a/its/inx.its b/its/inx.its
new file mode 100644
index 000000000..88b13546c
--- /dev/null
+++ b/its/inx.its
@@ -0,0 +1,40 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/lib/inx/generate.py b/lib/inx/generate.py
index cfcb224e1..e94d22f6c 100644
--- a/lib/inx/generate.py
+++ b/lib/inx/generate.py
@@ -7,12 +7,10 @@ from .info import generate_info_inx_files
from .extensions import generate_extension_inx_files
from .inputs import generate_input_inx_files
from .outputs import generate_output_inx_files
-from .utils import iterate_inx_locales
def generate_inx_files():
- for locale in iterate_inx_locales():
- generate_input_inx_files()
- generate_output_inx_files()
- generate_extension_inx_files()
- generate_info_inx_files()
+ generate_input_inx_files()
+ generate_output_inx_files()
+ generate_extension_inx_files()
+ generate_info_inx_files()
diff --git a/lib/inx/utils.py b/lib/inx/utils.py
index 4a62c5077..944c265ce 100644
--- a/lib/inx/utils.py
+++ b/lib/inx/utils.py
@@ -3,15 +3,12 @@
# Copyright (c) 2010 Authors
# Licensed under the GNU GPL version 3.0 or later. See the file LICENSE for details.
-import errno
-import gettext
import os
import sys
from os.path import dirname
from jinja2 import Environment, FileSystemLoader
-from ..i18n import N_, locale_dir
from ..i18n import translation as default_translation
_top_path = dirname(dirname(dirname(os.path.realpath(__file__))))
@@ -20,7 +17,6 @@ template_path = os.path.join(_top_path, "templates")
version_path = _top_path
current_translation = default_translation
-current_locale = "en_US"
def build_environment():
@@ -31,7 +27,6 @@ def build_environment():
)
env.install_gettext_translations(current_translation)
- env.globals["locale"] = current_locale
with open(os.path.join(version_path, 'LICENSE'), 'r') as license:
env.globals["inkstitch_license"] = "".join(license.readlines())
@@ -40,53 +35,26 @@ def build_environment():
# building a ZIP release, with inkstitch packaged as a binary
# About extension: add version information
with open(os.path.join(version_path, 'VERSION'), 'r') as version:
- env.globals["inkstitch_version"] = "%s %s" % (version.readline(), current_locale)
+ env.globals["inkstitch_version"] = "%s" % version.readline()
# Command tag and icons path
if sys.platform == "win32":
- env.globals["command_tag"] = 'inkstitch/bin/inkstitch.exe'
- env.globals["image_path"] = 'inkstitch/bin/icons/'
+ env.globals["command_tag"] = '../bin/inkstitch.exe'
+ env.globals["image_path"] = '../bin/icons/'
elif sys.platform == "darwin":
- env.globals["command_tag"] = 'inkstitch.app/Contents/MacOS/inkstitch'
- env.globals["image_path"] = 'inkstitch.app/Contents/MacOS/icons/'
+ env.globals["command_tag"] = '../MacOS/inkstitch'
+ env.globals["image_path"] = '../MacOS/icons/'
else:
- env.globals["command_tag"] = 'inkstitch/bin/inkstitch'
- env.globals["image_path"] = 'inkstitch/bin/icons/'
+ env.globals["command_tag"] = '../bin/inkstitch'
+ env.globals["image_path"] = '../bin/icons/'
else:
# user is running inkstitch.py directly as a developer
- env.globals["command_tag"] = '../../inkstitch.py'
- env.globals["image_path"] = '../../icons/'
+ env.globals["command_tag"] = '../inkstitch.py'
+ env.globals["image_path"] = '../icons/'
env.globals["inkstitch_version"] = "Manual Install"
return env
def write_inx_file(name, contents):
- inx_locale_dir = os.path.join(inx_path, current_locale)
-
- try:
- os.makedirs(inx_locale_dir)
- except OSError as e:
- if e.errno != errno.EEXIST:
- raise
-
inx_file_name = "inkstitch_%s.inx" % name
- with open(os.path.join(inx_locale_dir, inx_file_name), 'w', encoding="utf-8") as inx_file:
+ with open(os.path.join(inx_path, inx_file_name), 'w', encoding="utf-8") as inx_file:
print(contents, file=inx_file)
-
-
-def iterate_inx_locales():
- global current_translation, current_locale
-
- locales = sorted(os.listdir(locale_dir))
- for locale in locales:
- translation = gettext.translation("inkstitch", locale_dir, languages=[locale], fallback=True)
-
- # L10N If you translate this string, that will tell Ink/Stitch to
- # generate menu items for this language in Inkscape's "Extensions"
- # menu.
- magic_string = N_("Generate INX files")
- translated_magic_string = translation.gettext(magic_string)
-
- if translated_magic_string != magic_string or locale == "en_US":
- current_translation = translation
- current_locale = locale
- yield locale
diff --git a/templates/about.xml b/templates/about.xml
index 5b7f0ab7d..8ad2c7834 100644
--- a/templates/about.xml
+++ b/templates/about.xml
@@ -1,18 +1,18 @@
-
- {% trans %}About{% endtrans %}
- org.inkstitch.about.{{ locale }}
+
+ About
+ org.inkstitch.about
-
+
{{ image_path }}inkstitch_colour_logo.svg
-
+
-
+
{{ inkstitch_license }}
diff --git a/templates/auto_satin.xml b/templates/auto_satin.xml
index 673ac51e6..426ea0941 100644
--- a/templates/auto_satin.xml
+++ b/templates/auto_satin.xml
@@ -1,15 +1,15 @@
-
- {% trans %}Auto-Route Satin Columns{% endtrans %}
- org.inkstitch.auto_satin.{{ locale }}
- true
- false
+
+ Auto-Route Satin Columns
+ org.inkstitch.auto_satin
+ true
+ false
auto_satin
all
-
+
diff --git a/templates/break_apart.xml b/templates/break_apart.xml
index 83333ad19..9f6e579fb 100644
--- a/templates/break_apart.xml
+++ b/templates/break_apart.xml
@@ -1,18 +1,18 @@
-
- {% trans %}Break Apart Fill Objects{% endtrans %}
- org.inkstitch.break_apart.{{ locale }}
+
+ Break Apart Fill Objects
+ org.inkstitch.break_apart
break_apart
all
-
+
- {% trans %}This extension will try to repair fill shapes and break them apart if necessary. Holes will be retained. Use on simple or overlapping shapes.{% endtrans %}
+ This extension will try to repair fill shapes and break them apart if necessary. Holes will be retained. Use on simple or overlapping shapes.
diff --git a/templates/cleanup.xml b/templates/cleanup.xml
index a5cd5713e..e84d5a34b 100644
--- a/templates/cleanup.xml
+++ b/templates/cleanup.xml
@@ -1,20 +1,20 @@
-
- {% trans %}Cleanup Document{% endtrans %}
- org.inkstitch.cleanup.{{ locale }}
- {% trans %}Use this extension to remove small objects from the document.{% endtrans %}
- true
- 20
+
+ Cleanup Document
+ org.inkstitch.cleanup
+ Use this extension to remove small objects from the document.
+ true
+ 20
true
- 5
+ _gui-description="Removes small strokes shorter than defined by threshold.">true
+ 5
cleanup
all
-
+
diff --git a/templates/convert_to_satin.xml b/templates/convert_to_satin.xml
index 80f0b6789..13b362cfb 100644
--- a/templates/convert_to_satin.xml
+++ b/templates/convert_to_satin.xml
@@ -1,13 +1,13 @@
-
- {% trans %}Convert Line to Satin{% endtrans %}
- org.inkstitch.convert_to_satin.{{ locale }}
+
+ Convert Line to Satin
+ org.inkstitch.convert_to_satin
convert_to_satin
all
-
+
diff --git a/templates/convert_to_stroke.xml b/templates/convert_to_stroke.xml
index 620258bae..6b1e5afc6 100644
--- a/templates/convert_to_stroke.xml
+++ b/templates/convert_to_stroke.xml
@@ -1,16 +1,16 @@
-
- {% trans %}Convert Satin to Stroke{% endtrans %}
- org.inkstitch.convert_to_stroke.{{ locale }}
+
+ Convert Satin to Stroke
+ org.inkstitch.convert_to_stroke
convert_to_stroke
- {% trans %}Converts a satin column into a running stitch.{% endtrans %}
+ Converts a satin column into a running stitch.
false
+ _gui-description="Do not delete original satin column.">false
all
-
+
diff --git a/templates/cut_satin.xml b/templates/cut_satin.xml
index b780543ad..00f4292d6 100644
--- a/templates/cut_satin.xml
+++ b/templates/cut_satin.xml
@@ -1,13 +1,13 @@
-
- {% trans %}Cut Satin Column{% endtrans %}
- org.inkstitch.cut_satin.{{ locale }}
+
+ Cut Satin Column
+ org.inkstitch.cut_satin
cut_satin
all
-
+
diff --git a/templates/duplicate_params.xml b/templates/duplicate_params.xml
index 1cefd7a99..7e5c998b6 100644
--- a/templates/duplicate_params.xml
+++ b/templates/duplicate_params.xml
@@ -1,13 +1,13 @@
-
- {% trans %}Duplicate Params{% endtrans %}
- org.inkstitch.duplicate_params.{{ locale }}
+
+ Duplicate Params
+ org.inkstitch.duplicate_params
duplicate_params
all
-
+
diff --git a/templates/embroider.xml b/templates/embroider.xml
index ff56ac7d6..7f42594be 100644
--- a/templates/embroider.xml
+++ b/templates/embroider.xml
@@ -1,17 +1,17 @@
-
- {% trans %}Embroider{% endtrans %}
- org.inkstitch.embroider.{{ locale }}
- {% trans %}Create a stitch file{% endtrans %}
- {% trans %}Save your embroidery file through | File > Save a Copy ... |{% endtrans %}
- {% trans %}Choose from listed embroidery file formats and save.{% endtrans %}
+
+ Embroider
+ org.inkstitch.embroider
+ Create a stitch file
+ Save your embroidery file through | File > Save a Copy ... |
+ Choose from listed embroidery file formats and save.
- {% trans %}Multiple file formats can be saved by choosing the zip file format.{% endtrans %}
+ Multiple file formats can be saved by choosing the zip file format.
all
-
+
diff --git a/templates/embroider_settings.xml b/templates/embroider_settings.xml
index 1c7bc966e..5f2f2c94e 100644
--- a/templates/embroider_settings.xml
+++ b/templates/embroider_settings.xml
@@ -1,7 +1,7 @@
-
- {% trans %}Preferences{% endtrans %}
- org.inkstitch.embroider_settings.{{ locale }}
+
+ Preferences
+ org.inkstitch.embroider_settings
embroider_settings
all
@@ -10,11 +10,11 @@
- {% trans %}Output Settings{% endtrans %}
+ Output Settings
3
+ _gui-text="Collapse length (mm)"
+ _gui-description="Jump stitches smaller than this will be treated as normal stitches.">3
diff --git a/templates/flip.xml b/templates/flip.xml
index 29b114575..22c937aa1 100644
--- a/templates/flip.xml
+++ b/templates/flip.xml
@@ -1,13 +1,13 @@
-
- {% trans %}Flip Satin Column Rails{% endtrans %}
- org.inkstitch.flip_satins.{{ locale }}
+
+ Flip Satin Column Rails
+ org.inkstitch.flip_satins
flip
all
-
+
diff --git a/templates/global_commands.xml b/templates/global_commands.xml
index d37e2e41a..0fda86bd7 100644
--- a/templates/global_commands.xml
+++ b/templates/global_commands.xml
@@ -1,8 +1,8 @@
-
- {% trans %}Add Commands{% endtrans %}
- org.inkstitch.global_commands.{{ locale }}
- {% trans %}These commands affect the entire embroidery design.{% endtrans %}
+
+ Add Commands
+ org.inkstitch.global_commands
+ These commands affect the entire embroidery design.
{% for command, description in global_commands %}
false
{% endfor %}
@@ -12,7 +12,7 @@
{# L10N Inkscape submenu under Extensions -> Ink/Stitch #}
-
+
diff --git a/templates/import_threadlist.xml b/templates/import_threadlist.xml
index e846f13ba..8562d82d1 100644
--- a/templates/import_threadlist.xml
+++ b/templates/import_threadlist.xml
@@ -1,7 +1,7 @@
-
- {% trans %}Import Threadlist{% endtrans %}
- org.inkstitch.import_threadlist.{{ locale }}
+
+ Import Threadlist
+ org.inkstitch.import_threadlist
import_threadlist
@@ -17,7 +17,7 @@
all
-
+
diff --git a/templates/input.xml b/templates/input.xml
index 5f4a4610f..a348df5c1 100644
--- a/templates/input.xml
+++ b/templates/input.xml
@@ -1,7 +1,7 @@
-
+
{{ format | upper }} file input
- org.inkstitch.input.{{ format }}.{{ locale }}
+ org.inkstitch.input.{{ format }}
.{{ format }}
application/x-embroidery-{{ format }}
diff --git a/templates/install.xml b/templates/install.xml
index e351dc311..4254de36f 100644
--- a/templates/install.xml
+++ b/templates/install.xml
@@ -1,13 +1,13 @@
-
- {% trans %}Install thread color palettes for Inkscape{% endtrans %}
- org.inkstitch.install.{{ locale }}
+
+ Install thread color palettes for Inkscape
+ org.inkstitch.install
install
all
-
+
diff --git a/templates/install_custom_palette.xml b/templates/install_custom_palette.xml
index cb2865c70..badbc4322 100644
--- a/templates/install_custom_palette.xml
+++ b/templates/install_custom_palette.xml
@@ -1,16 +1,16 @@
-
- {% trans %}Install custom palette{% endtrans %}
- org.inkstitch.install_custom_palette.{{ locale }}
+
+ Install custom palette
+ org.inkstitch.install_custom_palette
install_custom_palette
-
-
+
+
all
-
+
diff --git a/templates/layer_commands.xml b/templates/layer_commands.xml
index 249d536e7..2584df704 100644
--- a/templates/layer_commands.xml
+++ b/templates/layer_commands.xml
@@ -1,8 +1,8 @@
-
- {% trans %}Add Layer Commands{% endtrans %}
- org.inkstitch.layer_commands.{{ locale }}
- {% trans %}Commands will be added to the currently-selected layer.{% endtrans %}
+
+ Add Layer Commands
+ org.inkstitch.layer_commands
+ Commands will be added to the currently-selected layer.
{% for command, description in layer_commands %}
false
{% endfor %}
@@ -11,7 +11,7 @@
all
-
+
diff --git a/templates/lettering.xml b/templates/lettering.xml
index 6dea9e93e..be8b092e9 100644
--- a/templates/lettering.xml
+++ b/templates/lettering.xml
@@ -1,7 +1,7 @@
-
- {% trans %}Lettering{% endtrans %}
- org.inkstitch.lettering.{{ locale }}
+
+ Lettering
+ org.inkstitch.lettering
lettering
all
diff --git a/templates/lettering_custom_font_dir.xml b/templates/lettering_custom_font_dir.xml
index a281dbd6b..49abf2ff5 100644
--- a/templates/lettering_custom_font_dir.xml
+++ b/templates/lettering_custom_font_dir.xml
@@ -1,24 +1,24 @@
-
- {% trans %}Custom font directory{% endtrans %}
- org.inkstitch.lettering_custom_font_dir.{{ locale }}
+
+ Custom font directory
+ org.inkstitch.lettering_custom_font_dir
lettering_custom_font_dir
all
-
+
- {% trans %}Set a custom directory for additional fonts to be used with the lettering tool.{% endtrans %}
+ Set a custom directory for additional fonts to be used with the lettering tool.
-
+
- {% trans %}Usage: The custom font directory must contain a subdirectory for each font.{% endtrans %}
+ Usage: The custom font directory must contain a subdirectory for each font.