Skip to content

Instantly share code, notes, and snippets.

@flodolo
Last active January 8, 2016 16:07
Show Gist options
  • Save flodolo/29cc0a7cbfefbd64252d to your computer and use it in GitHub Desktop.
Save flodolo/29cc0a7cbfefbd64252d to your computer and use it in GitHub Desktop.
Update iOS with individual commits
#! /usr/bin/env bash
# Place your updated en-US XLIFF file inside /en-US before starting the script
ios_build_tools=/home/flodolo/mozilla/git/firefox-ios-build-tools/
ios_l10n_repository=/home/flodolo/mozilla/git/firefoxios-l10n/
# Create a branch in the repository
cd ${ios_l10n_repository}
branch_name=$(date +"%Y%m%d_%H%M")
git branch ${branch_name}
git checkout ${branch_name}
# Commit then en-US file
git add en-US/firefox-ios.xliff
git commit -m "en-US: update firefox-ios.xliff"
# Update all locales
${ios_build_tools}/scripts/update-xliff.py .
# Commit each locale separately
locale_list=$(find . -mindepth 1 -maxdepth 1 -type d \( ! -iname ".*" \) | sed 's|^\./||g' | sort)
for locale in ${locale_list};
do
# Exclude en-US and templates
if [ "${locale}" != "en-US" ] && [ "${locale}" != "templates" ]
then
git add ${locale}/firefox-ios.xliff
git commit -m "${locale}: Update firefox-ios.xliff"
fi
done
# Copy the en-US file in /templates
cp en-US/firefox-ios.xliff templates/firefox-ios.xliff
# Clean up /templates removing target-language and translations
${ios_build_tools}//scripts/clean-xliff.py templates
git add templates/firefox-ios.xliff
git commit -m "templates: update firefox-ios.xliff"
# Push to repository
git push origin ${branch_name}
# Move back to the main folder
cd ..
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment