aboutsummaryrefslogtreecommitdiffstats
path: root/bin/merge_cobrand_po
blob: 9e9c1c075f31d0589780eb29c96fb72fe84f4f3b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/env perl
use strict;

=for instructions

This script is used to merge cobrand po files with the main
FixMyStreet po file. It should be run after generate_cobrand_po
and once the cobrand po files with translations are placed in the
language directories.

It will then create an autoCobrand.po file for each language that
has a Cobrand.po

=cut

my $cobrand = shift;

die "Please provide a cobrand name\n" unless $cobrand;

# for each language create a .po file with an existing translations
for (glob( 'locale/*/LC_MESSAGES' ) ) {
    my $fms = "$_/FixMyStreet.po";
    my $cobrand_po = "$_/$cobrand.po";
    my $out = "$_/auto$cobrand.po";
    if ( -e $cobrand_po and -e $fms ) {
        print "$_\n";
        system("msgcat --use-first --no-wrap -o $out $fms $cobrand_po");
    }
}