~ubuntu-branches/ubuntu/intrepid/nautilus-cd-burner/intrepid

« back to all changes in this revision

Viewing changes to intltool-merge.in

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2007-09-18 10:21:18 UTC
  • mfrom: (1.1.27 upstream)
  • Revision ID: james.westby@ubuntu.com-20070918102118-pnw3sijnrgem7vi4
Tags: 2.20.0-0ubuntu1
New upstream version

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
## Release information
36
36
my $PROGRAM = "intltool-merge";
37
37
my $PACKAGE = "intltool";
38
 
my $VERSION = "0.35.5";
 
38
my $VERSION = "0.36.1";
39
39
 
40
40
## Loaded modules
41
41
use strict; 
93
93
 
94
94
my %po_files_by_lang = ();
95
95
my %translations = ();
96
 
my $iconv = $ENV{"ICONV"} || $ENV{"INTLTOOL_ICONV"} || "@INTLTOOL_ICONV@";
 
96
my $iconv = $ENV{"ICONV"} || "iconv";
97
97
my $devnull = ($^O eq 'MSWin32' ? 'NUL:' : '/dev/null');
98
98
 
 
99
sub isProgramInPath
 
100
{
 
101
    my ($file) = @_;
 
102
    # If either a file exists, or when run it returns 0 exit status
 
103
    return 1 if ((-x $file) or (system("$file --version >$devnull") == 0));
 
104
    return 0;
 
105
}
 
106
 
 
107
if (! isProgramInPath ("$iconv"))
 
108
{
 
109
        print STDERR " *** iconv is not found on this system!\n".
 
110
                     " *** Without it, intltool-merge can not convert encodings.\n";
 
111
        exit;
 
112
}
 
113
 
99
114
# Use this instead of \w for XML files to handle more possible characters.
100
115
my $w = "[-A-Za-z0-9._:]";
101
116
 
260
275
 
261
276
sub gather_po_files
262
277
{
263
 
    for my $po_file (glob "$PO_DIR/*.po") {
264
 
        $po_files_by_lang{po_file2lang($po_file)} = $po_file;
 
278
    if (my $linguas = $ENV{"LINGUAS"})
 
279
    {
 
280
        for my $lang (split / /, $linguas) {
 
281
            my $po_file = $PO_DIR . "/" . $lang . ".po";
 
282
            if (-e $po_file) {
 
283
                $po_files_by_lang{$lang} = $po_file;
 
284
            }
 
285
        }
 
286
    }
 
287
    else
 
288
    {
 
289
        if (open LINGUAS_FILE, "$PO_DIR/LINGUAS")
 
290
        {
 
291
            while (<LINGUAS_FILE>)
 
292
            {
 
293
                next if /^#/;
 
294
 
 
295
                if (/([-a-zA-Z_@.]+)\n/)
 
296
                {
 
297
                    my $lang = $1;
 
298
 
 
299
                    my $po_file = $PO_DIR . "/" . $lang . ".po";
 
300
                    if (-e $po_file) {
 
301
                        $po_files_by_lang{$lang} = $po_file;
 
302
                    }
 
303
                }
 
304
            }
 
305
 
 
306
            close LINGUAS_FILE;
 
307
        }
 
308
        else
 
309
        {
 
310
            for my $po_file (glob "$PO_DIR/*.po") {
 
311
                $po_files_by_lang{po_file2lang($po_file)} = $po_file;
 
312
            }
 
313
        }
265
314
    }
266
315
}
267
316