Whether I use crowdin download -l de or the export_languages in the crowdin.yml the downloaded *.xcstrings catalogues always include all languages of the project.
Even tho the arguments are accepted and other translations such as .json are not downloaded.
This appears to be an issue with the xcstrings generation specifically. The only solution currently is to delete the language from the project.
Hi @ruddarr the thing is that this file is multilingual and translations to all languages are added within one file while when working with json, the system will create a separate file for each language and export it separately. On export it worked for json with the option since the system just doesn’t export that separate file for French for example, while for xcstrings this option can’t trim the language from the inside of the file
Thank you for reaching out. Our Post-Export apps are indeed a recommended solution for customizing exports to fit your specific needs. While we understand that you may prefer a direct fix on our end, utilizing these apps allows for greater flexibility and immediate results without waiting for a platform-wide update.
Should you require any assistance in setting up or configuring the Post-Export apps, please don’t hesitate to contact us.
We’re here to help ensure your workflow is as smooth as possible!
That’s disappointing. Might be worth mentioning in your documentation that export languages do not work with xcstrings so users know it’s intentional.
If anyone is finding this via search, this is how we solved it:
brew install crowdin yq
EXPORTED=(en $(yq '.export_languages[]' crowdin.yml))
# Convert to Apple language codes
EXPORTED=("${EXPORTED[@]/es-ES/es}")
# Download translations
FLAGS=$(yq '.export_languages[]' crowdin.yml | awk '{printf "--language=%s ", $0}')
crowdin download translations --plain ${FLAGS}
cd project-name
# Remove languages that are not exported from *.xcstrings catalogs
for file in Localizable.xcstrings AppShortcuts.xcstrings; do
for lang in $(jq -r '.strings[].localizations | keys[]' $file | sort -u); do
if [[ ! ${EXPORTED[@]} =~ $lang ]]; then
jq "del(.strings[].localizations.${lang})" $file > "${file}.json"
mv "${file}.json" $file
fi
done
done