summaryrefslogtreecommitdiff
path: root/bin/generate-translation-files
diff options
context:
space:
mode:
authorKaalleen <36401965+kaalleen@users.noreply.github.com>2021-09-26 11:42:17 +0200
committerGitHub <noreply@github.com>2021-09-26 11:42:17 +0200
commitfcd13815d31f4b927e498fbbb4305fb29a959acf (patch)
treef67f6c4da8bf83bf9c6f8a8302fe8211e5049541 /bin/generate-translation-files
parent12828b0d6249a738eee0d7f76d27c2f8317fc92d (diff)
One Version for all Languages (#1346)
Co-authored-by: Lex Neva <github.com@lexneva.name>
Diffstat (limited to 'bin/generate-translation-files')
-rw-r--r--bin/generate-translation-files27
1 files changed, 27 insertions, 0 deletions
diff --git a/bin/generate-translation-files b/bin/generate-translation-files
new file mode 100644
index 00000000..c1f77a30
--- /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;