--- /dev/null
+#! /bin/bash
+
+# Copy Email Self-Defense translations locally from enc to enc-live.
+# and update the language pickers.
+# The two repos are assumed to have the same parent directory.
+# The script is called from the root of enc-live:
+# copy-enc-to-live LANG
+
+# ***** Check that lang-picker-source is up to date. *****
+
+set -e
+
+lang=$1
+pages='confirmation.html index.html infographic.html next_steps.html workshops.html'
+
+test -n "$lang" || (echo " !!! Please enter a language code as argument.";
+ exit 1)
+
+# The files we need are on the master branch of enc.
+cd ../enc
+git co master
+# Get the ID of the last commit on this branch for future reference, and
+# truncate it to 7 digits.
+commit=$(git rev-parse HEAD | cut -b -7)
+
+# Go back to enc-live.
+cd ../enc-live
+# Create the LANG directory if it doesn't exist.
+mkdir -p $lang
+
+# Take one page at a time.
+for p in $pages; do
+ echo $lang/$p
+ # If it exists in enc,
+ if [ -f ../enc/$lang/$p ]; then
+ # copy it to enc-live.
+ cp ../enc/$lang/$p $lang/
+ # If not...
+ else
+ # say so,
+ echo " !!! $lang/$p doesn't exist"
+ # restore enc-live to its original state,
+ git reset --hard HEAD
+ # and quit.
+ exit 1
+ fi
+done
+
+# Add and commit the changes.
+git add $lang
+# Refer to the enc commit ID in the enc-live commit message.
+git commit -m "$lang: synchronize with enc $commit."
+
+replace-lang-picker
--- /dev/null
+<li><a href="/en">English - v5.0</a></li>
+<li><a href="/es">español - v5.0</a></li>
+<li><a href="/fr">français - v5.0</a></li>
+<li><a href="/tr">Türkçe - v5.0</a></li>
+<!--<li><a href="/cs">čeština - v4.0</a></li>
+<li><a href="/de">Deutsch - v4.0</a></li>
+<li><a href="/el">ελληνικά - v3.0</a></li>
+<li><a href="/fa">فارسی - v4.0</a></li>
+<li><a href="/it">italiano - v3.0</a></li>
+<li><a href="/ja">日本語 - v4.0</a></li>
+<li><a href="/pt-br">português do Brasil - v3.0</a></li>
+<li><a href="/ro">română - v3.0</a></li>
+<li><a href="/ru">русский - v4.0</a></li>
+<li><a href="/sq">Shqip - v4.0</a></li>
+<li><a href="/sv">svenska - v4.0</a></li>
+<li><a href="/zh-hans">简体中文 - v4.0</a></li>-->
--- /dev/null
+#!/bin/bash
+
+# Replace the language picker site-wide, using a common source file:
+# "lang-picker-source". The script is called from the root of enc-live.
+# It doesn't take an argument.
+
+set -e
+set -o pipefail
+
+head=$(mktemp -t rt.XXXXXX) || exit 1
+picker=$(mktemp -t rt.XXXXXX) || exit 1
+tail=$(mktemp -t rt.XXXXXX) || exit 1
+trap 'rm -f "$head" "$picker" "$tail"' EXIT
+
+# List all HTML files with a language picker and take them one by one.
+# The regex will select index and workshops.
+find . -regex "\./.*/[iw][no][dr].*\.html" -not -path "./missing/*" |
+sort | sed 's,^\./,,' | while read f; do
+ # Extract the language from the file name.
+ lang=${f%%/*}
+ # Make sure the page is correctly formatted.
+ if grep -q '<ul id="languages" class="os">' $f &&
+ grep -q '<li><strong><a href=.*Translation_Guide">' $f; then
+ # Add the 'current' class to the relevant item of lang-picker-source.
+ sed "s,<li><a href=\"/$lang\">,<li><a class=\"current\" href=\"/$lang\">," \
+ lang-picker-source > $picker
+ # Extract what's before the language picker...
+ sed -n '1,/<ul id="languages" class="os">/p' $f > $head
+ # and what follows it.
+ sed -n '/<li><strong><a href=.*Translation_Guide">/,$p' $f > $tail
+ # Assemble.
+ cat $head $picker $tail > $f
+ else
+ echo " !!! Unable to replace the language picker in $f."
+ exit 1
+ fi
+done
+
+# Commit the changes.
+git add */index.html */workshops.html
+git commit -m "index & workshops: update the language picker."