2001-08-17 08:28:31 +00:00
|
|
|
#!@-PERL-@ -w
|
|
|
|
|
# -*- perl -*-
|
|
|
|
|
#
|
|
|
|
|
# This perl script is used to make po/POTFILES.in, the list
|
2006-02-02 18:47:34 +00:00
|
|
|
# of files to be searched for translatable strings.
|
|
|
|
|
#
|
2008-01-07 20:19:06 +00: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 08:28:31 +00:00
|
|
|
#
|
|
|
|
|
# Author: Dave Peticolas <dave@krondo.com>
|
|
|
|
|
|
|
|
|
|
use strict;
|
|
|
|
|
use File::Basename;
|
|
|
|
|
|
2006-02-02 18:47:34 +00:00
|
|
|
# Note: These are perl regexp patterns, *not* normal shell wildcards!
|
2009-03-13 15:07:39 +00:00
|
|
|
my @ignorepatterns = ('gw-', 'test', 'experimental', 'python-bindings', 'swig-.*\.c');
|
2014-08-08 13:31:29 -07: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 18:47:34 +00:00
|
|
|
|
2014-09-19 17:36:16 +02: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 (-,_,.)
|
|
|
|
|
#
|
2017-08-03 12:02:49 +02:00
|
|
|
# This sort function has been extracted into a separate file (util/elegant-sort.pl)
|
|
|
|
|
# in order to use the same algorithm in both cmake and autools based builds
|
2014-09-19 17:36:16 +02:00
|
|
|
|
2017-08-03 12:02:49 +02:00
|
|
|
my @possible_files = `cd @-SRCDIR-@ && \\
|
2017-08-17 15:25:41 +02:00
|
|
|
find bindings borrowed common libgnucash gnucash -name '*.c' \\
|
2014-08-08 13:37:38 -07:00
|
|
|
-o -name '*.cpp' -o -name '*.glade' \\
|
2006-01-19 00:40:32 +00:00
|
|
|
-o -name '*.desktop.in' -o -name '*.keys.in' \\
|
2017-08-03 12:02:49 +02:00
|
|
|
-o -name '*.gschema.xml.in.in' -o -name '*.scm' \\
|
|
|
|
|
| util/elegant-sort.pl`;
|
2005-11-14 20:36:33 +00:00
|
|
|
## For perl files add the following:
|
|
|
|
|
# -o -name '*.pl'
|
2005-11-13 16:20:49 +00:00
|
|
|
|
2006-02-02 18:47:34 +00: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 20:36:33 +00:00
|
|
|
|
2001-08-17 08:28:31 +00:00
|
|
|
my %ignores;
|
2001-09-17 22:27:01 +00:00
|
|
|
foreach my $file (@possible_files) {
|
2006-02-02 18:47:34 +00:00
|
|
|
chomp($file);
|
|
|
|
|
my ($name, $path) = fileparse($file);
|
|
|
|
|
$path =~ s/^\.\///;
|
2005-11-14 20:36:33 +00:00
|
|
|
|
2008-01-07 20:19:06 +00:00
|
|
|
foreach my $pat (@ignorepatterns, @skipped_files, @ignored_files) {
|
2006-02-02 18:47:34 +00:00
|
|
|
chomp($pat);
|
|
|
|
|
next unless $pat;
|
2006-02-01 20:32:11 +00:00
|
|
|
|
2006-02-02 18:47:34 +00:00
|
|
|
if ($file =~ m/$pat/ || $name =~ m/$pat/ || $path =~ m/$pat/) {
|
|
|
|
|
$ignores{$path . $name} = 1;
|
|
|
|
|
}
|
2005-11-14 20:36:33 +00:00
|
|
|
}
|
2006-02-02 18:47:34 +00:00
|
|
|
next if $ignores{$path . $name};
|
2017-08-03 12:02:49 +02:00
|
|
|
|
2006-02-02 18:47:34 +00:00
|
|
|
# Ignore unreadable files, e.g. dangling symlinks
|
2008-01-15 20:40:19 +00:00
|
|
|
next unless (-r "@-SRCDIR-@/" . $path . $name);
|
2013-11-05 18:37:45 +00:00
|
|
|
|
|
|
|
|
# Force parse type for gsettings files
|
|
|
|
|
my $type = "";
|
|
|
|
|
if ($file =~ m/.gschema.xml.in.in/ ){
|
|
|
|
|
$type = "[type: gettext/gsettings]";
|
|
|
|
|
}
|
2017-08-03 12:02:49 +02:00
|
|
|
|
2013-11-05 18:37:45 +00:00
|
|
|
print $type . $path . $name . "\n";
|
2001-08-17 08:28:31 +00:00
|
|
|
}
|
2001-09-18 10:12:50 +00:00
|
|
|
|
2017-08-10 13:56:00 +02:00
|
|
|
# These are manually added, because they're not picked up by the generation script
|
|
|
|
|
print "gnucash/gnome/gnucash.appdata.xml.in\n";
|
|
|
|
|
print "gnucash/gnome/gnucash.desktop.in.in\n";
|
|
|
|
|
print "libgnucash/engine/qofbookslots.h\n";
|
2010-04-22 20:45:22 +00:00
|
|
|
print "doc/tip_of_the_day.list.in\n";
|