From 2b7580f18637371ebe953eaa5d9539061dcf956b Mon Sep 17 00:00:00 2001 From: "mr. m" <91018726+mauro-balades@users.noreply.github.com> Date: Sun, 12 Jan 2025 16:34:01 +0100 Subject: [PATCH] Discard changes to scripts/copy-language-pack.sh --- scripts/copy-language-pack.sh | 42 +++++++++-------------------------- 1 file changed, 10 insertions(+), 32 deletions(-) diff --git a/scripts/copy-language-pack.sh b/scripts/copy-language-pack.sh index 186767ede..7215efd5d 100644 --- a/scripts/copy-language-pack.sh +++ b/scripts/copy-language-pack.sh @@ -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