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