From 1ab5b42353d2510d051731b4318564d3a7ddaaf7 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Mon, 11 Mar 2019 11:09:03 +0100 Subject: prepare-release: Add merge-translations command This command allows merging translations from another branch. This is to be used strictly downwards, that is, translations should be merged from newest to oldest branch, without skipping any active branch, to ensure the best result. For example, consider branches 1 and 2 have the strings "a" and "b" to translate, but master only has the strings "a" and "c". Now, 2 has more translations for "b" than 1. By merging master into 2, and 2 into 1, 1 also gets any translations for "b" from 2. --- prepare-release | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/prepare-release b/prepare-release index c93976f9a..ea749f85d 100755 --- a/prepare-release +++ b/prepare-release @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash set -e cd "$(readlink -f $(dirname $0))" @@ -341,6 +341,23 @@ elif [ "$1" = 'spellcheckers' -o "$1" = 'lint' ]; then -e '^I: po/es.po: duplicate-header-field X-POFile-SpellExtra$' \ || true fi +elif [ "$1" = "merge-translations" ]; then + if [ -z "$2" ]; then + echo "Usage:\t$0 $1 " >&2 + exit 1 + fi + for i in {doc/,}po/*.po ; do + # 1. concatenate the translations, picking new translations + # 2. merge the translations so we only have matching translations left + # 3. remove any newly introduced obsolete translations (only in $2) + # 4. concatenate again to restore "old" obsolete translations + # 5. write output + msgcat --use-first <(git show $2:$i) $i \ + | msgmerge --no-fuzzy --previous - $i \ + | msgattrib --no-obsolete - \ + | msgcat --use-first - $i \ + | sponge $i + done else echo >&1 "Usage:\t$0 pre-export \t$0 pre-build @@ -373,6 +390,10 @@ runs all tests and generates a html report in the end. »spellcheckers« runs »codespell« and »spellintian« on the appropiate files and filters out obvious false positives. + +\t$0 merge-translations branch + +Merge translations from the given branch. " fi -- cgit v1.2.3-18-g5258