source: osm/applications/editors/josm/plugins/photoadjust/pomerge.pl@ 30154

Last change on this file since 30154 was 30137, checked in by holgermappt, 12 years ago

Update of translation chain. Added translated languages.

  • Property svn:executable set to *
File size: 1.1 KB
Line 
1#! /usr/bin/perl -w
2###
3### pomerge.pl - Run msgmerge with the files in the po directory and
4### remove untranslated strings.
5
6use strict;
7use File::Spec::Functions;
8
9### Directory with PO files that are to be merged.
10my $podir = "po";
11### Path to POT file.
12my $potfile = catfile($podir, "photoadjust.pot");
13
14foreach my $pofile (split("\n", `find $podir -name "*.po"`)) {
15 ### Merge translation with template.
16 my $cmd = "msgmerge --quiet --update --backup=none $pofile $potfile";
17 system $cmd;
18
19 ### Get rid of all unneeded translations. Fuzzy translations are
20 ### removed too. msgattrib will not write an output file if nothing
21 ### is left. We move the original file and delete it afterwards to
22 ### preserve only languages with translations.
23 my $potmp = $pofile . ".tmp";
24 rename $pofile, $potmp;
25 $cmd = "msgattrib --output-file=$pofile --translated --no-fuzzy --no-obsolete $potmp";
26 system $cmd;
27 unlink $potmp;
28 if (-z $pofile) {
29 ### The PO file might be empty if there are no translated strings.
30 unlink $pofile;
31 }
32 if (-e $pofile . "~") {
33 ### Remove the backup copy.
34 unlink $pofile . "~";
35 }
36}
Note: See TracBrowser for help on using the repository browser.