1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-11-02 08:52:45 +01:00
uBlock/tools/import-crowdin.sh

52 lines
1.5 KiB
Bash
Raw Normal View History

#!/usr/bin/env bash
#
# This script assumes a linux environment
2021-07-31 23:34:25 +02:00
set -e
echo "*** uBlock: Importing from Crowdin archive"
SRC=~/Downloads/crowdin
rm -r $SRC || true > /dev/null
unzip -q ~/Downloads/uBlock\ \(translations\).zip -d $SRC
# https://www.assertnotmagic.com/2018/06/20/bash-brackets-quick-reference/
DES=./src/_locales
DESMV3=./platform/mv3/extension/_locales
for dir in $SRC/*/; do
srclang=$(basename $dir)
deslang=${srclang/-/_}
deslang=${deslang%_AM}
deslang=${deslang%_ES}
deslang=${deslang%_IN}
deslang=${deslang%_LK}
deslang=${deslang%_NL}
deslang=${deslang%_PK}
deslang=${deslang%_SE}
if [[ $deslang == 'en' ]]; then
continue
fi
# ubo
mkdir -p "$DES/$deslang/" && cp "$SRC/$srclang/messages.json" "$DES/$deslang/"
# ubo lite
mkdir -p "$DESMV3/$deslang/" && cp "$SRC/$srclang/uBO-Lite/messages.json" "$DESMV3/$deslang/"
# descriptions
#cp "$SRC/$srclang/description.txt" "./dist/description/description-${deslang}.txt"
2022-11-29 17:04:54 +01:00
cp "$SRC/$srclang/uBO-Lite/webstore.txt" "./platform/mv3/description/webstore.$deslang.txt"
done
# Output files with possible misuse of `$`, as this can lead to severe
# consequences, such as not being able to run the extension at all.
# uBO does not use `$`, so any instance of `$` must be investigated.
# See https://issues.adblockplus.org/ticket/6666
echo "*** uBlock: Instances of '\$':"
2021-10-16 15:03:12 +02:00
grep -FR "$" $DES/ || true
grep -FR "$" $DESMV3/ || true
rm -r $SRC
echo "*** uBlock: Import done."
git status