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