mirror of
https://github.com/zen-browser/desktop.git
synced 2025-07-07 23:00:01 +02:00
Discard changes to scripts/download-language-packs.sh
This commit is contained in:
parent
2b7580f186
commit
143218913d
1 changed files with 34 additions and 48 deletions
|
@ -1,64 +1,50 @@
|
||||||
#!/bin/bash
|
set -ex
|
||||||
|
|
||||||
set -euo pipefail # Exit immediately if a command exits with a non-zero status, treat unset variables as errors, and fail on pipe errors.
|
|
||||||
|
|
||||||
CURRENT_DIR=$(pwd)
|
CURRENT_DIR=$(pwd)
|
||||||
|
|
||||||
# Configure Git settings
|
|
||||||
git config --global init.defaultBranch main
|
git config --global init.defaultBranch main
|
||||||
git config --global fetch.prune true
|
git config --global fetch.prune true
|
||||||
|
|
||||||
# Clone the Firefox localization repository
|
cd $CURRENT_DIR
|
||||||
L10N_DIR="$CURRENT_DIR/l10n"
|
|
||||||
FIREFOX_L10N_REPO="https://github.com/mozilla-l10n/firefox-l10n"
|
|
||||||
|
|
||||||
# Ensure the l10n directory exists
|
cd ./l10n
|
||||||
if [ ! -d "$L10N_DIR" ]; then
|
git clone https://github.com/mozilla-l10n/firefox-l10n
|
||||||
mkdir -p "$L10N_DIR"
|
cd $CURRENT_DIR
|
||||||
fi
|
|
||||||
|
|
||||||
cd "$L10N_DIR"
|
|
||||||
|
|
||||||
if [ ! -d "firefox-l10n" ]; then
|
|
||||||
git clone "$FIREFOX_L10N_REPO"
|
|
||||||
else
|
|
||||||
echo "The repository 'firefox-l10n' already exists. Pulling the latest changes."
|
|
||||||
cd firefox-l10n
|
|
||||||
git pull origin main
|
|
||||||
cd ..
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Function to update language files
|
|
||||||
update_language() {
|
update_language() {
|
||||||
local langId=$1
|
langId=$1
|
||||||
local LANG_DIR="$L10N_DIR/$langId"
|
cd ./l10n
|
||||||
echo "Updating $langId..."
|
cd $langId
|
||||||
|
|
||||||
# Check if the language directory exists
|
echo "Updating $langId"
|
||||||
if [ -d "../firefox-l10n/$langId" ]; then
|
# move the contents from ../firefox-l10n/$langId to ./l10n/$langId
|
||||||
rsync -av --progress "../firefox-l10n/$langId/" "$LANG_DIR/" --exclude .git
|
rsync -av --progress ../firefox-l10n/$langId/ . --exclude .git
|
||||||
else
|
|
||||||
echo "Warning: Language directory '$langId' does not exist in the repository."
|
cd $CURRENT_DIR
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Set PATH for git-cinnabar
|
|
||||||
export PATH=~/tools/git-cinnabar:$PATH
|
export PATH=~/tools/git-cinnabar:$PATH
|
||||||
|
for lang in $(cat ./l10n/supported-languages); do
|
||||||
# Update all supported languages
|
update_language $lang
|
||||||
SUPPORTED_LANGUAGES_FILE="$L10N_DIR/l10n/supported-languages"
|
done
|
||||||
if [[ -f "$SUPPORTED_LANGUAGES_FILE" ]]; then
|
cd $CURRENT_DIR
|
||||||
while read -r lang; do
|
|
||||||
update_language "$lang"
|
|
||||||
done < "$SUPPORTED_LANGUAGES_FILE"
|
|
||||||
else
|
|
||||||
echo "Error: 'supported-languages' file not found."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Move all the files to the correct location
|
# Move all the files to the correct location
|
||||||
sh scripts/copy-language-pack.sh en-US
|
|
||||||
|
|
||||||
while read -r lang; do
|
sh scripts/copy-language-pack.sh en-US
|
||||||
sh scripts/copy-language-pack.sh "$lang"
|
for lang in $(cat ./l10n/supported-languages); do
|
||||||
done < "$SUPPORTED_LANGUAGES_FILE"
|
sh scripts/copy-language-pack.sh $lang
|
||||||
|
done
|
||||||
|
|
||||||
|
wait
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
rm -rf ./l10n/firefox-l10n
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue