From c60a4178de4dc41c4efe363719a41648d896752b Mon Sep 17 00:00:00 2001 From: Malin Freeborn Date: Wed, 6 Sep 2023 22:42:47 +0200 Subject: [PATCH] attempt automatic config translations --- i18n/autolang.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100755 i18n/autolang.sh diff --git a/i18n/autolang.sh b/i18n/autolang.sh new file mode 100755 index 0000000..19a2a37 --- /dev/null +++ b/i18n/autolang.sh @@ -0,0 +1,13 @@ +#!/bin/bash +# This script attempts to automatically generate a language file. +# It produces ugly results with strange grammar, but it might save a translator some time. + +[ -z "$1" ] && echo 'Start this script with a language code, e.g. "./autolang.sh el"' + +cat en.toml | while read -r line; do + echo "$line" | grep '=' -q && \ + old="$(echo "$line" | cut -d= -f2)" && \ + new="$(echo "$old" | trans en:$1 -b -e google)" && \ + echo "$line" | sed "s/$old/$new/" >> $1.toml || \ + echo "$line" >> $1.toml +done