attempt automatic config translations

This commit is contained in:
Malin Freeborn 2023-09-06 22:42:47 +02:00
parent be1a68b0e4
commit c60a4178de
Signed by: andonome
GPG Key ID: 52295D2377F4D70F
1 changed files with 13 additions and 0 deletions

13
i18n/autolang.sh Executable file
View File

@ -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