From 99aad09bd041cb3e518f2ade4238beab84243366 Mon Sep 17 00:00:00 2001 From: Antoine GIRARD Date: Tue, 21 Jan 2020 17:26:17 +0100 Subject: [PATCH] Filter locales under 25% (#9893) * Create update-locales.sh * Update .drone.yml * fix file perms +x --- .drone.yml | 5 +---- scripts/update-locales.sh | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 4 deletions(-) create mode 100755 scripts/update-locales.sh diff --git a/.drone.yml b/.drone.yml index 422319cfe0..4c0504df77 100644 --- a/.drone.yml +++ b/.drone.yml @@ -317,10 +317,7 @@ steps: pull: default image: alpine:3.11 commands: - - 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" - - mv ./options/locale_en-US.ini ./options/locale/ + - ./scripts/update-locales.sh - name: push pull: always diff --git a/scripts/update-locales.sh b/scripts/update-locales.sh new file mode 100755 index 0000000000..214474da76 --- /dev/null +++ b/scripts/update-locales.sh @@ -0,0 +1,18 @@ +#!/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 + +# Remove translation under 25% of en_us +baselines=`wc -l "./options/locale_en-US.ini" | cut -d" " -f1` +baselines=$((baselines / 4)) +for filename in ./options/locale/*.ini; do + lines=`wc -l "$filename" | cut -d" " -f1` + if [ $lines -lt $baselines ]; then + echo "Removing $filename: $lines/$baselines" + rm "$filename" + fi +done + +mv ./options/locale_en-US.ini ./options/locale/