-
-
Save mamarx/9f4464dd8b2c95139aad to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# UpdateTranslations.sh | |
# | |
# Created by Malte Marx on 13.08.14. | |
# Copyright (c) 2014 marxbeck GmbH. All rights reserved. | |
localizationsPath="Resources/Localizations" | |
controllersPath="Controllers" | |
languages=(de en es fr) | |
storyboards=(Controller1 Controller2 Controller3) | |
# For each storyboard | |
for storyboard in ${storyboards[@]} ; do | |
# Push english translation file | |
phrase push ${controllersPath}/${storyboard}/en.lproj/${storyboard}.strings --locale=en --tags=${storyboard} | |
# Pull language translations and clean and rename folders for each language | |
for language in ${languages[@]} ; do | |
# Pull translation files into storyboard folder | |
phrase pull ${language} --target=${controllersPath}/${storyboard}/ --format=strings --tag=${storyboard} | |
# Clean and rename | |
if [ -f ${controllersPath}/${storyboard}/${language}.lproj/Localizable.strings ] ; then | |
rm -f ${controllersPath}/${storyboard}/${language}.lproj/${storyboard}.strings | |
mv ${controllersPath}/${storyboard}/${language}.lproj/Localizable.strings ${controllersPath}/${storyboard}/${language}.lproj/${storyboard}.strings | |
fi | |
done | |
done | |
# Generate new entries in Base locale for new translation keys | |
find ./ -name "*.m" -print0 | xargs -0 genstrings -o ${localizationsPath}/Base.lproj | |
# Push to PhraseApp | |
phrase push ${localizationsPath}/Base.lproj/Localizable.strings --locale=Base --tags=Localizable | |
phrase push ${localizationsPath}/Base.lproj/InfoPlist.strings --locale=Base --tags=InfoPlist | |
# Pull from PhraseApp | |
phrase pull --target=${localizationsPath} --format=strings |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment