diff options
Diffstat (limited to 'dist-tools/git-commit-po-updates.sh')
-rwxr-xr-x | dist-tools/git-commit-po-updates.sh | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/dist-tools/git-commit-po-updates.sh b/dist-tools/git-commit-po-updates.sh index 13e2bf5c..8f633d88 100755 --- a/dist-tools/git-commit-po-updates.sh +++ b/dist-tools/git-commit-po-updates.sh @@ -31,27 +31,33 @@ done git diff -G ^.Project-Id-Version --name-only po/*.po \ | while read pofile ; do if ! cmd="$(perl -WT - "$pofile" <<'_EOF' +use Encode::Locale; +use Encode; use strict; use Carp::Always (); use warnings FATAL => 'uninitialized'; -my ($ver, $dat, $trl, $lang, $lcod, $found); +my ($ver, $dat, $trl, $lang, $lcod, $cset, $found); while(<>) { - if (/^"Project-Id-Version: (.+)\\n"/) { $ver=$1 }; - if (/^"PO-Revision-Date: (.+)\\n"/) { $dat=$1 }; - if (/^"Last-Translator: (.+)\\n"/) { $trl=$1 }; + if (/^"Project-Id-Version: (.+)\\n"/) { $ver=$1; }; + if (/^"PO-Revision-Date: (.+)\\n"/) { $dat=$1; }; + if (/^"Last-Translator: (.+)\\n"/) { $trl=$1; }; if (/^"Language-Team: ([^<]+?)\s+<.*>\\n"/) - { $lang=$1 }; - if (/^"Language: (.+)\\n"/) { $lcod=$1 }; - if ($ver and $dat and $trl and $lang and $lcod) { + { $lang=$1; }; + if (/^"Language: (.+)\\n"/) { $lcod=$1; }; + if (/^"Content-Type: text\/plain; charset=(.+)\\n"/) + { $cset = $1; }; + if ($ver and $dat and $trl and $lang and $lcod and $cset) { $found = 1; last; } } +$trl = Encode::decode($cset, $trl); + if ($found) { - print "git commit --author '$trl' --date '$dat' -m 'Update <$lcod> $lang translation to $ver'" + print Encode::encode(locale => "git commit --author '$trl' --date '$dat' -m 'Update <$lcod> $lang translation to $ver'", Encode::FB_CROAK); } else { exit(1); } |