Update download-language-packs.sh

Signed-off-by: Cristian Cezar Moisés <ethicalhacker@riseup.net>
This commit is contained in:
Cristian Cezar Moisés
2025-01-03 22:59:38 +00:00
committed by GitHub
parent 8c129ab512
commit 08e4b07364

View File

@@ -1,51 +1,51 @@
set -ex
CURRENT_DIR=$(pwd)
# Configure Git settings
git config --global init.defaultBranch main
git config --global fetch.prune true
cd $CURRENT_DIR
cd ./l10n
# Clone the Firefox localization repository
cd "$CURRENT_DIR/l10n"
git clone https://github.com/mozilla-l10n/firefox-l10n
cd $CURRENT_DIR
# Function to update language files
update_language() {
langId=$1
cd ./l10n
cd $langId
cd "$CURRENT_DIR/l10n/$langId"
echo "Updating $langId"
# move the contents from ../firefox-l10n/$langId to ./l10n/$langId
rsync -av --progress ../firefox-l10n/$langId/ . --exclude .git
cd $CURRENT_DIR
# Move the contents from ../firefox-l10n/$langId to ./l10n/$langId
rsync -av --progress "../firefox-l10n/$langId/" . --exclude .git
}
# Set PATH for git-cinnabar
export PATH=~/tools/git-cinnabar:$PATH
for lang in $(cat ./l10n/supported-languages); do
update_language $lang
done
cd $CURRENT_DIR
# Update all supported languages
while read -r lang; do
update_language "$lang"
done < ./l10n/supported-languages
# Move all the files to the correct location
sh scripts/copy-language-pack.sh en-US
for lang in $(cat ./l10n/supported-languages); do
sh scripts/copy-language-pack.sh $lang
done
while read -r lang; do
sh scripts/copy-language-pack.sh "$lang"
done < ./l10n/supported-languages
wait
# Clean up temporary files
echo "Cleaning up"
rm -rf ~/tools
rm -rf ~/.git-cinnabar
for lang in $(cat ./l10n/supported-languages); do
# remove every file except if it starts with "zen"
find ./l10n/$lang -type f -not -name "zen*" -delete
done
# Remove files that do not start with "zen"
while read -r lang; do
find "./l10n/$lang" -type f -not -name "zen*" -delete
done < ./l10n/supported-languages
# Remove the cloned repository
rm -rf ./l10n/firefox-l10n