From de2df034e17001bc07a0b63c7f518e3e1c94b859 Mon Sep 17 00:00:00 2001 From: Hannu Nyman Date: Fri, 15 May 2020 16:59:59 +0300 Subject: [PATCH] build: add i18n-merge-openwrt-19.07 Support backporting translation strings from 19.07 to 18.06 by adding a script for that. Targeted workflow is: 1) sync 18.06 to apps 2) backport 19.07 translations 3) re-sync 18.06 just in case 4) backport master translations 5) re-sync 18.06 just in case Signed-off-by: Hannu Nyman --- build/i18n-merge-openwrt-1907.pl | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100755 build/i18n-merge-openwrt-1907.pl diff --git a/build/i18n-merge-openwrt-1907.pl b/build/i18n-merge-openwrt-1907.pl new file mode 100755 index 000000000..8691b0bf4 --- /dev/null +++ b/build/i18n-merge-openwrt-1907.pl @@ -0,0 +1,22 @@ +#!/usr/bin/env perl + +if (open F, '-|', 'find', $ARGV[0] || '.', '-type', 'f', '-name', '*.po') { + while (defined(my $path = readline F)) { + chomp $path; + + (my $ref = $path) =~ s/\.po$/\.master.po/; + + printf 'Updating %s ', $path; + my $returnCode = system("git show --format=\%B 'openwrt-19.07:$path' > '$ref'"); + if ( $returnCode == 0 ) + { + system('msgmerge', '-N', '-o', $path, $ref, $path); + system('msgattrib', '--no-obsolete', '-o', $path, $path); + } else { + print "...failed due to git error.\n"; + } + unlink($ref); + } + + close F; +} -- 2.25.1