summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorguillep2k <18600385+guillep2k@users.noreply.github.com>2020-01-25 03:19:35 -0300
committertechknowlogick <techknowlogick@gitea.io>2020-01-25 01:19:35 -0500
commita47cfdf346231efe33d683ad4db20b3b7f6f2edc (patch)
tree2ccab4a1a098bf993a77cb1c79c631eac9143c5c /scripts
parent9d5756989a94b382d5a49b23b6aaebc602add587 (diff)
downloadgitea-a47cfdf346231efe33d683ad4db20b3b7f6f2edc.tar.gz
gitea-a47cfdf346231efe33d683ad4db20b3b7f6f2edc.zip
Fix crowdin update script (#9969)
* Fix crowdin update script * Refine the script to be specific about what it should change Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/update-locales.sh9
1 files changed, 7 insertions, 2 deletions
diff --git a/scripts/update-locales.sh b/scripts/update-locales.sh
index 214474da76..f73282799c 100755
--- a/scripts/update-locales.sh
+++ b/scripts/update-locales.sh
@@ -1,8 +1,13 @@
#!/bin/sh
mv ./options/locale/locale_en-US.ini ./options/
-sed -i -e 's/=\"/=/g' -e 's/\"$$//g' ./options/locale/*.ini
-sed -i -e 's/\\\\\\\\\"/\"/g' ./options/locale/*.ini
+
+# Make sure to only change lines that have the translation enclosed between quotes
+sed -i -r -e '/^[a-zA-Z0-9_-.]+[ ]*=[ ]*".*"$/ {
+ s/^([a-zA-Z0-9_-.]+)[ ]*="/\1=/
+ s/\\"/"/g
+ s/"$//
+ }' ./options/locale/*.ini
# Remove translation under 25% of en_us
baselines=`wc -l "./options/locale_en-US.ini" | cut -d" " -f1`