Skip to content

Commit

Permalink
Add phraseapp push/pull scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
bdorfman-stripe committed Aug 25, 2016
1 parent 1beec5e commit 401507c
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .phraseapp.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
phraseapp:
project_id: becaaad32db57a68fa6a9cc7e84cd684
file_format: strings
push:
sources:
- file: Stripe/Resources/Localizations/en.lproj/Localizable.strings
params:
locale_id: de84834fe809e8f3f90a5e2239ac3711
update_translations: true
convert_emoji: true
pull:
targets:
- file: Stripe/Resources/Localizations/<locale_code>.lproj/Localizable.strings
params:
file_format: strings
convert_emoji: true
encoding: UTF-8
1 change: 1 addition & 0 deletions ci_scripts/pull_translations.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
phraseapp pull -t `fetch-password PhraseApp-access-token`
39 changes: 39 additions & 0 deletions ci_scripts/push_translations.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
echo "Generating strings files..."
find Stripe -name \*.m | xargs genstrings -s STPLocalizedString -o Stripe/Resources/Localizations/en.lproj

if [[ $? -eq 0 ]]; then

if [[ -z $(which recode) ]]; then
if [[ -z $(which brew) ]]; then
echo "Please install homebrew or the recode command line tool"
exit 1
else
brew install recode
fi

if [[ $? -eq 0 ]]; then

echo "Converting to utf8..."
# Genstrings outputs in utf16 but we want to store in utf8
recode utf16..utf8 Stripe/Resources/Localizations/en.lproj/Localizable.strings

if [[ -z $(which phraseapp) ]]; then
if [[ -z $(which brew) ]]; then
echo "Please install homebrew/phraseapp cli client"
exit 1
else
echo "Installing phraseapp via homebrew..."
brew tap phrase/brewed
brew install phraseapp
fi
fi

echo "Uploading to Phrase..."
phraseapp push -t `fetch-password PhraseApp-access-token`

else
echo "Error recoding into utf8"
fi
else
echo "Error occured generating english strings file."
fi

0 comments on commit 401507c

Please sign in to comment.