2021-07-31 20:49:32 +02:00
|
|
|
#!/usr/bin/env bash
|
2014-10-17 21:44:19 +02:00
|
|
|
#
|
|
|
|
# This script assumes a linux environment
|
|
|
|
|
2021-07-31 23:34:25 +02:00
|
|
|
set -e
|
|
|
|
|
2014-10-17 21:44:19 +02:00
|
|
|
echo "*** uBlock: Importing from Crowdin archive"
|
2014-11-16 17:41:20 +01:00
|
|
|
|
|
|
|
SRC=~/Downloads/crowdin
|
2022-09-13 23:44:24 +02:00
|
|
|
rm -r $SRC || true > /dev/null
|
2020-08-22 15:08:14 +02:00
|
|
|
unzip -q ~/Downloads/uBlock\ \(translations\).zip -d $SRC
|
2014-11-16 17:41:20 +01:00
|
|
|
|
2022-09-13 23:44:24 +02:00
|
|
|
# https://www.assertnotmagic.com/2018/06/20/bash-brackets-quick-reference/
|
|
|
|
|
2014-11-16 17:41:20 +01:00
|
|
|
DES=./src/_locales
|
2022-09-13 23:44:24 +02:00
|
|
|
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
|
2022-09-13 23:58:12 +02:00
|
|
|
mkdir -p "$DESMV3/$deslang/" && cp "$SRC/$srclang/uBO-Lite/messages.json" "$DESMV3/$deslang/"
|
2022-09-13 23:44:24 +02:00
|
|
|
# descriptions
|
2022-09-13 23:58:12 +02:00
|
|
|
#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"
|
2022-09-13 23:44:24 +02:00
|
|
|
done
|
2014-10-17 21:44:19 +02:00
|
|
|
|
2018-05-14 13:51:49 +02:00
|
|
|
# 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
|
2022-09-13 23:44:24 +02:00
|
|
|
grep -FR "$" $DESMV3/ || true
|
2018-05-14 13:51:49 +02:00
|
|
|
|
2014-10-17 21:44:19 +02:00
|
|
|
|
2014-11-16 17:41:20 +01:00
|
|
|
rm -r $SRC
|
2014-10-17 21:44:19 +02:00
|
|
|
echo "*** uBlock: Import done."
|
2017-11-27 20:52:25 +01:00
|
|
|
git status
|