diff options
| author | mojganii <mojgan.jelodar@mullvad.net> | 2025-08-19 11:58:09 +0200 |
|---|---|---|
| committer | mojganii <mojgan.jelodar@mullvad.net> | 2025-08-19 11:58:54 +0200 |
| commit | cd31b68a3b4dcab8dc2f4a004975d857807e5d82 (patch) | |
| tree | 9952bd5794d7f838aeffef61576ba00591416743 /ios/translation/scripts | |
| parent | f514c592d0af93399a2c8891051da480cc68513e (diff) | |
| download | mullvadvpn-cd31b68a3b4dcab8dc2f4a004975d857807e5d82.tar.xz mullvadvpn-cd31b68a3b4dcab8dc2f4a004975d857807e5d82.zip | |
Remove unneeded keys for translation
Diffstat (limited to 'ios/translation/scripts')
| -rwxr-xr-x | ios/translation/scripts/localizations.sh | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/ios/translation/scripts/localizations.sh b/ios/translation/scripts/localizations.sh index 5232442e19..2129e3aa5a 100755 --- a/ios/translation/scripts/localizations.sh +++ b/ios/translation/scripts/localizations.sh @@ -95,6 +95,34 @@ export_localizations() { done } +clean_xliff_translations() { + xliff_dir="$LOCALIZATION_DIR" + if [[ ! -d "$xliff_dir" ]]; then + echo "โ Directory not found: $xliff_dir" + return 1 + fi + + # Dictionary of keys to ignore for translation + declare -A UNNEEDED_KEYS=( + ["CFBundleName"]=1 + ["CFBundleDisplayName"]=1 + # Add more keys here if needed + ) + + echo "๐งน Cleaning unneeded keys from XLIFFs in $xliff_dir" + for xliff in "$xliff_dir"/*.xliff; do + if [[ -f "$xliff" ]]; then + for key in "${!UNNEEDED_KEYS[@]}"; do + sed -i '' -E "/<trans-unit[^>]*id=\"$key\"[^>]*>/,/<\/trans-unit>/d" "$xliff" + done + echo "โ๏ธ Cleaned $xliff" + else + echo "โ ๏ธ File not found: $xliff, skipping" + fi + done + +} + import_localizations() { # Directory where the .xliff files are stored XLIFF_DIR="$LOCALIZATION_DIR" @@ -129,6 +157,7 @@ localization_to_export() { echo "๐ Export script started at: $(date)" build_project export_localizations + clean_xliff_translations cleanup_build_folder cleanup_temp_folder echo "๐ Export complete. Crowdin-ready .xliff files are in: $LOCALIZATION_DIR" |
