]> git.p6c8.net - jirafeau/mojo42.git/blobdiff - lib/locales/add.sh
[TASK] Add scripts to add, remove and delete locales
[jirafeau/mojo42.git] / lib / locales / add.sh
diff --git a/lib/locales/add.sh b/lib/locales/add.sh
new file mode 100755 (executable)
index 0000000..aba8bc9
--- /dev/null
@@ -0,0 +1,10 @@
+#!/bin/bash
+set -e
+new=$1
+if [ -z "$new" ]; then
+    echo "please pass the new string id to add as parameter"
+    exit 1
+fi
+locales_dir=$(cd "$(dirname $0)" && pwd)
+new_line="    \"$new\": \"\","
+find $locales_dir -type f -name "*.json" -print0 | xargs -0 sed -i "s/{/{\n${new_line}/"

patrick-canterino.de