Skip to content

Instantly share code, notes, and snippets.

@zbraniecki
Forked from flodolo/ftl_migration.sh
Last active February 4, 2018 05:15
Show Gist options
  • Save zbraniecki/cf8c495910a233a893d43c129f7f9fdb to your computer and use it in GitHub Desktop.
Save zbraniecki/cf8c495910a233a893d43c129f7f9fdb to your computer and use it in GitHub Desktop.
FTL Migration script
#! /usr/bin/env bash
# trizen -S python2-virtualenv
# virutalenv2 migrate
# source migrate/bin/activate
# pip install mercurial
# pip install python-hglib
# sh ./ftl_migration.sh
function interrupt_code()
# This code runs if user hits control-c
{
echored "\n*** Operation interrupted ***\n"
exit $?
}
# Trap keyboard interrupt (control-c)
trap interrupt_code SIGINT
# Add third_party/python/ to $PYTHONPATH
mozilla_unified_path="/home/zbraniecki/projects/mozilla-unified"
l10n_clones_path="/home/zbraniecki/projects/l10n-central"
python_fluent_path="/home/zbraniecki/projects/fluent/python-fluent/"
compare_locales_path="/home/zbraniecki/projects/compare-locales/"
export PYTHONPATH="${python_fluent_path}:${compare_locales_path}:${PYTHONPATH}:${mozilla_unified_path}/third_party/python/:${mozilla_unified_path}/python/l10n/fluent_migrations/"
cd ${l10n_clones_path}
# Uncomment for testing purposes on one locale, comment the existing for line
test=( "it" )
for locale in $test
# for locale in */
do
# Remove trailing slash from $locale
locale=${locale%/}
# Pull from hg server
hg --cwd ${l10n_clones_path}/${locale} pull -u -r default
# Run migration
# Add --dry-run to not commit
python ${mozilla_unified_path}/third_party/python/fluent/tools/migrate/migrate-l10n.py \
--lang ${locale} \
--reference-dir ${mozilla_unified_path} \
--localization-dir ${l10n_clones_path}/${locale} \
bug_1424682_preferences_chrome
# --dry-run \
# Push to hg server
# hg --cwd ${l10n_clones_path}/${locale} push
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment