From c9d3ab52257c4b795067f31940a7b9b943ce25f1 Mon Sep 17 00:00:00 2001 From: Julien Palard Date: Sat, 27 May 2017 19:51:09 +0200 Subject: [PATCH] Document how I merged pot files. --- README.rst | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/README.rst b/README.rst index 30d24e03..8fed2e9f 100644 --- a/README.rst +++ b/README.rst @@ -175,3 +175,27 @@ Find fuzzy strings: .. code-block:: bash grep -c fuzzy **/*.po | grep -v ':1$\|:0$' + + +Merge pot files from cpython doc: + +.. code-block:: bash + + VERSION=3.6 + git clone --depth 1 --branch $VERSION https://github.com/python/cpython.git /tmp/cpython/ + (cd /tmp/cpython/ && sphinx-build -Q -b gettext -D gettext_compact=0 Doc pot/) + POT_PATH="/tmp/cpython/pot/" + PO_PATH="./" + + find "$POT_PATH" -name '*.pot' | + while read -r POT + do + PO="$PO_PATH/$(echo "$POT" | sed "s#$POT_PATH##; s#\.pot\$#.po#")" + mkdir -p "$(dirname "$PO")" + if [ -f "$PO" ] + then + msgmerge --backup=off --force-po -U "$PO" "$POT" + else + msgcat -o "$PO" "$POT" + fi + done