mirror of
https://github.com/zen-browser/desktop.git
synced 2025-07-07 23:00:01 +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
|
browser_locales=engine/browser/locales
|
||||||
|
|
||||||
# Constants
|
|
||||||
BROWSER_LOCALES="engine/browser/locales"
|
|
||||||
L10N_DIR="./l10n"
|
|
||||||
SUPPORTED_LANGS=("en-US" "fr" "de" "es") # Add any other supported languages
|
|
||||||
|
|
||||||
copy_browser_locales() {
|
copy_browser_locales() {
|
||||||
local langId="$1"
|
langId=$1
|
||||||
mkdir -p "$BROWSER_LOCALES/$langId" || { echo "Error: Failed to create directory $BROWSER_LOCALES/$langId"; exit 1; }
|
mkdir -p $browser_locales/$langId
|
||||||
|
|
||||||
if [ "$langId" = "en-US" ]; then
|
if [ "$langId" = "en-US" ]; then
|
||||||
# Remove specific files for en-US
|
find $browser_locales/$langId -type f -name "zen*" -delete
|
||||||
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/en-US/browser/ $browser_locales/$langId/
|
||||||
rsync -av --exclude=.git "$L10N_DIR/en-US/browser/" "$BROWSER_LOCALES/$langId/" || { echo "Error: rsync failed for en-US"; exit 1; }
|
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
rm -rf $browser_locales/$langId/
|
||||||
rm -rf "$BROWSER_LOCALES/$langId/" || { echo "Error: Failed to remove existing directory $BROWSER_LOCALES/$langId"; exit 1; }
|
# TODO: Copy the rest of the l10n directories to their respective locations
|
||||||
|
rsync -av --exclude=.git ./l10n/$langId/ $browser_locales/$langId/
|
||||||
# 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; }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Check if a language was specified
|
LANG=$1
|
||||||
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
|
|
||||||
|
|
||||||
echo "Copying language pack for $LANG"
|
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