mirror of
https://github.com/Gnucash/gnucash.git
synced 2024-12-02 05:29:20 -06:00
d57a7ceed2
The Character Encoding menu imported from goffice comes with many such strings. I still need to find a nice way to copy the existing translations for them from goffice directly to gnucash.
92 lines
2.6 KiB
Perl
92 lines
2.6 KiB
Perl
#!@-PERL-@ -w
|
|
# -*- perl -*-
|
|
#
|
|
# This perl script is used to make po/POTFILES.in, the list
|
|
# of files to be searched for translatable strings.
|
|
#
|
|
# It will exclude any files listed in po/POTFILES.skip, po/POTFILES.ignore
|
|
# or that match the regexp patterns listed in @ignorepatterns.
|
|
#
|
|
# Author: Dave Peticolas <dave@krondo.com>
|
|
|
|
use strict;
|
|
use File::Basename;
|
|
|
|
# Note: These are perl regexp patterns, *not* normal shell wildcards!
|
|
my @ignorepatterns = ('gw-', 'test', 'experimental', 'python-bindings', 'swig-.*\.c');
|
|
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;
|
|
|
|
# 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)
|
|
}
|
|
|
|
my @possible_files = sort sort_func
|
|
`cd @-SRCDIR-@ && find src lib -name '*.c' \\
|
|
-o -name '*.cpp' -o -name '*.glade' \\
|
|
-o -name '*.desktop.in' -o -name '*.keys.in' \\
|
|
-o -name '*.gschema.xml.in.in' -o -name '*.scm'`;
|
|
## For perl files add the following:
|
|
# -o -name '*.pl'
|
|
|
|
print "# This is a list of files which contain translatable strings.\n";
|
|
print "# This file was generated by ../make-gnucash-potfiles.\n";
|
|
|
|
my %ignores;
|
|
foreach my $file (@possible_files) {
|
|
chomp($file);
|
|
my ($name, $path) = fileparse($file);
|
|
$path =~ s/^\.\///;
|
|
|
|
foreach my $pat (@ignorepatterns, @skipped_files, @ignored_files) {
|
|
chomp($pat);
|
|
next unless $pat;
|
|
|
|
if ($file =~ m/$pat/ || $name =~ m/$pat/ || $path =~ m/$pat/) {
|
|
$ignores{$path . $name} = 1;
|
|
}
|
|
}
|
|
next if $ignores{$path . $name};
|
|
|
|
# Ignore unreadable files, e.g. dangling symlinks
|
|
next unless (-r "@-SRCDIR-@/" . $path . $name);
|
|
|
|
# Force parse type for gsettings files
|
|
my $type = "";
|
|
if ($file =~ m/.gschema.xml.in.in/ ){
|
|
$type = "[type: gettext/gsettings]";
|
|
}
|
|
|
|
print $type . $path . $name . "\n";
|
|
}
|
|
|
|
# These are also added, even though they are outside of src/
|
|
print "src/gnome/gnucash.appdata.xml.in\n";
|
|
print "src/gnome/gnucash.desktop.in.in\n";
|
|
print "src/libqof/qof/qofbookslots.h\n";
|
|
print "doc/tip_of_the_day.list.in\n";
|