mirror of
https://github.com/zen-browser/desktop.git
synced 2025-07-08 01:19:59 +02:00
Discard changes to scripts/copy-language-pack.sh
This commit is contained in:
parent
babdc9568f
commit
2b7580f186
1 changed files with 10 additions and 32 deletions
|
@ -1,40 +1,18 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Constants
|
||||
BROWSER_LOCALES="engine/browser/locales"
|
||||
L10N_DIR="./l10n"
|
||||
SUPPORTED_LANGS=("en-US" "fr" "de" "es") # Add any other supported languages
|
||||
browser_locales=engine/browser/locales
|
||||
|
||||
copy_browser_locales() {
|
||||
local langId="$1"
|
||||
mkdir -p "$BROWSER_LOCALES/$langId" || { echo "Error: Failed to create directory $BROWSER_LOCALES/$langId"; exit 1; }
|
||||
|
||||
langId=$1
|
||||
mkdir -p $browser_locales/$langId
|
||||
if [ "$langId" = "en-US" ]; then
|
||||
# Remove specific files for en-US
|
||||
find "$BROWSER_LOCALES/$langId" -type f -name "zen*" -delete || { echo "Error: Failed to delete zen files in $BROWSER_LOCALES/$langId"; exit 1; }
|
||||
rsync -av --exclude=.git "$L10N_DIR/en-US/browser/" "$BROWSER_LOCALES/$langId/" || { echo "Error: rsync failed for en-US"; exit 1; }
|
||||
find $browser_locales/$langId -type f -name "zen*" -delete
|
||||
rsync -av --exclude=.git ./l10n/en-US/browser/ $browser_locales/$langId/
|
||||
return
|
||||
fi
|
||||
|
||||
rm -rf "$BROWSER_LOCALES/$langId/" || { echo "Error: Failed to remove existing directory $BROWSER_LOCALES/$langId"; exit 1; }
|
||||
|
||||
# Copy the rest of the l10n directories to their respective locations
|
||||
rsync -av --exclude=.git "$L10N_DIR/$langId/" "$BROWSER_LOCALES/$langId/" || { echo "Error: rsync failed for $langId"; exit 1; }
|
||||
rm -rf $browser_locales/$langId/
|
||||
# TODO: Copy the rest of the l10n directories to their respective locations
|
||||
rsync -av --exclude=.git ./l10n/$langId/ $browser_locales/$langId/
|
||||
}
|
||||
|
||||
# Check if a language was specified
|
||||
if [ -z "$1" ]; then
|
||||
echo "Error: No language specified."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
LANG="$1"
|
||||
|
||||
# Validate input language against supported languages
|
||||
if [[ ! " ${SUPPORTED_LANGS[@]} " =~ " $LANG " ]]; then
|
||||
echo "Error: Unsupported language '$LANG'. Supported languages are: ${SUPPORTED_LANGS[*]}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
LANG=$1
|
||||
echo "Copying language pack for $LANG"
|
||||
copy_browser_locales "$LANG"
|
||||
copy_browser_locales $LANG
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue