2001-08-17 03:28:31 -05:00
|
|
|
#!@-PERL-@ -w
|
|
|
|
# -*- perl -*-
|
|
|
|
#
|
|
|
|
# This perl script is used to make po/POTFILES.in, the list
|
2006-02-02 12:47:34 -06:00
|
|
|
# of files to be searched for translatable strings.
|
|
|
|
#
|
2008-01-07 14:19:06 -06:00
|
|
|
# It will exclude any files listed in po/POTFILES.skip, po/POTFILES.ignore
|
|
|
|
# or that match the regexp patterns listed in @ignorepatterns.
|
2001-08-17 03:28:31 -05:00
|
|
|
#
|
|
|
|
# Author: Dave Peticolas <dave@krondo.com>
|
|
|
|
|
|
|
|
use strict;
|
|
|
|
use File::Basename;
|
|
|
|
|
2006-02-02 12:47:34 -06:00
|
|
|
# Note: These are perl regexp patterns, *not* normal shell wildcards!
|
2009-03-13 10:07:39 -05:00
|
|
|
my @ignorepatterns = ('gw-', 'test', 'experimental', 'python-bindings', 'swig-.*\.c');
|
2014-08-08 15:31:29 -05:00
|
|
|
my (@skipped_files, @ignored_files);
|
|
|
|
open(IN, "< @-SRCDIR-@/po/POTFILES.skip");
|
|
|
|
while (<IN>) {
|
|
|
|
push @skipped_files, $_ unless $_ =~ /^\#/;
|
|
|
|
}
|
|
|
|
close IN;
|
|
|
|
open(IN, "< @-SRCDIR-@/po/POTFILES.ignore");
|
|
|
|
while (<IN>) {
|
|
|
|
push @ignored_files, $_ unless $_ =~ /^\#/;
|
|
|
|
}
|
|
|
|
close IN;
|
2006-02-02 12:47:34 -06:00
|
|
|
|
2014-09-19 10:36:16 -05:00
|
|
|
# Sort filenames in POTFILES.in in a consistent way
|
|
|
|
# This reduces the amount of clutter in our version manangement system
|
|
|
|
# The files will be sorted
|
|
|
|
# * per directory
|
|
|
|
# * case-insensitive
|
|
|
|
# * ignoring punctuation (-,_,.)
|
|
|
|
#
|
|
|
|
sub sort_func
|
|
|
|
{
|
|
|
|
my $stripped_a = $a;
|
|
|
|
my $stripped_b = $b;
|
|
|
|
$stripped_a =~ s/[-_.]//g;
|
|
|
|
$stripped_b =~ s/[-_.]//g;
|
|
|
|
|
|
|
|
lc ($stripped_a) cmp lc ($stripped_b)
|
|
|
|
||
|
|
|
|
lc ($a) cmp lc ($b)
|
|
|
|
}
|
2006-02-02 12:47:34 -06:00
|
|
|
|
2014-09-19 10:36:16 -05:00
|
|
|
my @possible_files = sort sort_func
|
2017-01-14 10:24:13 -06:00
|
|
|
`cd @-SRCDIR-@ && find src lib -name '*.c' \\
|
2014-08-08 15:37:38 -05:00
|
|
|
-o -name '*.cpp' -o -name '*.glade' \\
|
2006-01-18 18:40:32 -06:00
|
|
|
-o -name '*.desktop.in' -o -name '*.keys.in' \\
|
2015-01-31 11:50:47 -06:00
|
|
|
-o -name '*.gschema.xml.in.in' -o -name '*.scm'`;
|
2005-11-14 14:36:33 -06:00
|
|
|
## For perl files add the following:
|
|
|
|
# -o -name '*.pl'
|
2005-11-13 10:20:49 -06:00
|
|
|
|
2006-02-02 12:47:34 -06:00
|
|
|
print "# This is a list of files which contain translatable strings.\n";
|
|
|
|
print "# This file was generated by ../make-gnucash-potfiles.\n";
|
2005-11-14 14:36:33 -06:00
|
|
|
|
2001-08-17 03:28:31 -05:00
|
|
|
my %ignores;
|
2001-09-17 17:27:01 -05:00
|
|
|
foreach my $file (@possible_files) {
|
2006-02-02 12:47:34 -06:00
|
|
|
chomp($file);
|
|
|
|
my ($name, $path) = fileparse($file);
|
|
|
|
$path =~ s/^\.\///;
|
2005-11-14 14:36:33 -06:00
|
|
|
|
2008-01-07 14:19:06 -06:00
|
|
|
foreach my $pat (@ignorepatterns, @skipped_files, @ignored_files) {
|
2006-02-02 12:47:34 -06:00
|
|
|
chomp($pat);
|
|
|
|
next unless $pat;
|
2006-02-01 14:32:11 -06:00
|
|
|
|
2006-02-02 12:47:34 -06:00
|
|
|
if ($file =~ m/$pat/ || $name =~ m/$pat/ || $path =~ m/$pat/) {
|
|
|
|
$ignores{$path . $name} = 1;
|
|
|
|
}
|
2005-11-14 14:36:33 -06:00
|
|
|
}
|
2006-02-02 12:47:34 -06:00
|
|
|
next if $ignores{$path . $name};
|
|
|
|
|
|
|
|
# Ignore unreadable files, e.g. dangling symlinks
|
2008-01-15 14:40:19 -06:00
|
|
|
next unless (-r "@-SRCDIR-@/" . $path . $name);
|
2013-11-05 12:37:45 -06:00
|
|
|
|
|
|
|
# Force parse type for gsettings files
|
|
|
|
my $type = "";
|
|
|
|
if ($file =~ m/.gschema.xml.in.in/ ){
|
|
|
|
$type = "[type: gettext/gsettings]";
|
|
|
|
}
|
2006-02-02 12:47:34 -06:00
|
|
|
|
2013-11-05 12:37:45 -06:00
|
|
|
print $type . $path . $name . "\n";
|
2001-08-17 03:28:31 -05:00
|
|
|
}
|
2001-09-18 05:12:50 -05:00
|
|
|
|
2006-02-01 14:32:11 -06:00
|
|
|
# These are also added, even though they are outside of src/
|
2014-01-24 15:08:30 -06:00
|
|
|
print "src/gnome/gnucash.appdata.xml.in\n";
|
2010-04-22 15:45:22 -05:00
|
|
|
print "src/gnome/gnucash.desktop.in.in\n";
|
2010-05-06 04:01:46 -05:00
|
|
|
print "src/libqof/qof/qofbookslots.h\n";
|
2010-04-22 15:45:22 -05:00
|
|
|
print "doc/tip_of_the_day.list.in\n";
|