summaryrefslogtreecommitdiffstats
path: root/tools/move-lang-files.sh
diff options
context:
space:
mode:
authorSimon Rettberg2016-07-29 17:17:34 +0200
committerSimon Rettberg2016-07-29 17:17:34 +0200
commit4b05a55da273e068aa48f02af61c5a5c0f4da2d9 (patch)
tree80b02bcfb4b88fa93cc2a3cf9e43a15ad5e09b6d /tools/move-lang-files.sh
parent[statistics] Fix minor layout issues (diff)
downloadslx-admin-4b05a55da273e068aa48f02af61c5a5c0f4da2d9.tar.gz
slx-admin-4b05a55da273e068aa48f02af61c5a5c0f4da2d9.tar.xz
slx-admin-4b05a55da273e068aa48f02af61c5a5c0f4da2d9.zip
Add ugly scripts to transform translation files to new format
Diffstat (limited to 'tools/move-lang-files.sh')
-rwxr-xr-xtools/move-lang-files.sh34
1 files changed, 34 insertions, 0 deletions
diff --git a/tools/move-lang-files.sh b/tools/move-lang-files.sh
new file mode 100755
index 00000000..39d0db51
--- /dev/null
+++ b/tools/move-lang-files.sh
@@ -0,0 +1,34 @@
+#!/bin/bash
+
+declare -rg PID=$$
+
+perror() {
+ echo "[ERROR] $*"
+ [ "$$" != "$PID" ] && kill "$PID"
+ exit 1
+}
+
+[ "$2" = "modules" -o "$2" = "templates" ] || perror "Second option must be modules or templates"
+
+declare -rg TRANS="$1"
+[ -z "$TRANS" ] && perror "Usage: $0 <language> modules|templates"
+declare -rg DIR="lang/${TRANS}/$2"
+[ -d "$DIR" ] || perror "No old modules dir for lang $TRANS"
+
+for mod in $(ls -1 "$DIR"); do
+ [ -d "$DIR/$mod" ] || continue
+ [ -z "$(ls -1 "$DIR/$mod")" ] && continue
+ DEST="modules/$mod/lang/$TRANS/templates"
+ echo " ******** $DIR/$mod --> $DEST *********"
+ mkdir -p "$DEST" || perror "Could not create $DEST"
+ cp -v -a "$DIR/$mod/"* "$DEST/" || perror "Could not copy"
+ git rm -r "$DIR/$mod"
+ git add "$DEST"
+done
+
+echo " -- Categories --"
+
+if [ -n "$(ls -1 "lang/${TRANS}/settings/")" ]; then
+ git mv "lang/${TRANS}/settings/"*.json "modules/baseconfig/lang/${TRANS}/" || perror "Could not move settings/categories names"
+fi
+