Skip to content

Instantly share code, notes, and snippets.

@roostr
Last active March 23, 2024 05:33
Show Gist options
  • Save roostr/d250676007c42539cb4f75e0daa2f6ba to your computer and use it in GitHub Desktop.
Save roostr/d250676007c42539cb4f75e0daa2f6ba to your computer and use it in GitHub Desktop.
Translate release notes
#!/bin/bash
# Translate your iOS app's release notes into other languages with an automated command-line translation service.
# Designed to work with Fastlane's directory layout
# Dependencies: brew install translate-shell
# set -ex
srcLang='en-US'
# Create an array of languages
dstLangs=(
'de-DE'
'es-ES'
'fr-FR'
'it'
'ja'
'pt-BR'
'ru'
'zh-Hans'
)
for dstLang in "${dstLangs[@]}" ; do
echo -en "Translating $dstLang..."
iFile="Metadata/$srcLang/release_notes.txt"
oFile="Metadata/$dstLang/release_notes.txt"
trans -i "$iFile" -o "$oFile" -s "$srcLang" -t "$dstLang" -b
# Clean up the white space formatting so we always have one space before and after certain leading characters.
sed -i "" 's/^ *• *\(.*$\)/ • \1/' "$oFile"
sed -i "" 's/^ *- *\(.*$\)/ - \1/' "$oFile"
echo -e "\rTranslated $dstLang. "
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment