summaryrefslogtreecommitdiff
path: root/LedgerSMB
diff options
context:
space:
mode:
authortetragon <tetragon@4979c152-3d1c-0410-bac9-87ea11338e46>2006-10-19 05:16:47 +0000
committertetragon <tetragon@4979c152-3d1c-0410-bac9-87ea11338e46>2006-10-19 05:16:47 +0000
commitdaf0ba582e9da4f48afc180767b270a22f0334f8 (patch)
treef430f903bff159e8cd881807b31428ad338d4bc0 /LedgerSMB
parent9352d506b48c47fb668165def52e53877c9d6010 (diff)
Update locales.pl for new directory layout.
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@236 4979c152-3d1c-0410-bac9-87ea11338e46
Diffstat (limited to 'LedgerSMB')
-rwxr-xr-xLedgerSMB/locales.pl41
1 files changed, 29 insertions, 12 deletions
diff --git a/LedgerSMB/locales.pl b/LedgerSMB/locales.pl
index 0ba4e2b9..91f61015 100755
--- a/LedgerSMB/locales.pl
+++ b/LedgerSMB/locales.pl
@@ -5,15 +5,26 @@
# -m do not generate missing files
use FileHandle;
-
+use Getopt::Long;
+Getopt::Long::Configure('bundling');
$basedir = "../..";
$bindir = "$basedir/bin";
+$customdir = "$bindir/custom";
$menufile = "menu.ini";
-foreach $item (@ARGV) {
- $item =~ s/-//g;
- $arg{$item} = 1;
+my $excludeCustom = 0;
+my $buildAll = 0;
+my $noMissing = 0;
+my $goodOpt = 0;
+$goodOpt = GetOptions (
+ 'n' => \$excludeCustom, 'no-custom' => \$excludeCustom,
+ 'a' => \$buildAll, 'build-all' => \$buildAll,
+ 'm' => \$noMissing, 'no-missing' => \$noMissing);
+
+if (!$goodOpt) {
+ printf "Invalid options\n";
+ exit 1;
}
open(FH, "LANGUAGE");
@@ -30,14 +41,18 @@ seekdir DIR, 0;
closedir DIR;
# put customized files into @customfiles
-@customfiles = () if ($arg{n});
+@customfiles = () if ($excludeCustom);
-if ($arg{n}) {
+if ($excludeCustom) {
@menufiles = ($menufile);
} else {
- opendir DIR, "$basedir" or die "$!";
+ opendir DIR, "$bindir" or die "$!";
@menufiles = grep { /.*?_$menufile$/ } readdir DIR;
closedir DIR;
+## unshift @menufiles, $menufile;
+## opendir DIR, "$customdir" or die "$!";
+## @menufiles = grep { /^$menufile$/ } readdir DIR;
+## closedir DIR;
unshift @menufiles, $menufile;
}
@@ -58,7 +73,8 @@ if (-f 'missing') {
}
foreach $file (@progfiles) {
-
+
+ next if -d "$bindir/$file";
%locale = ();
%submit = ();
%subrt = ();
@@ -161,7 +177,7 @@ $self{subs} = {
close FH;
- if (!$arg{m}) {
+ if (!$noMissing) {
if (@missing) {
open FH, ">$file.missing" or die "$! : missing";
@@ -189,7 +205,7 @@ $self{subs} = {
# redo the all file
- if ($arg{a}) {
+ if ($buildAll) {
open FH, ">all" or die "$! : all";
print FH q|# These are all the texts to build the translations files.
@@ -238,6 +254,7 @@ sub scanfile {
my ($file, $level) = @_;
my $fh = new FileHandle;
+ return unless (-e $file or $file !~ /custom/);
open $fh, "$file" or die "$! : $file";
$file =~ s/\.pl//;
@@ -273,7 +290,7 @@ sub scanfile {
my $newfile = $&;
$newfile =~ s/require\s+\W//;
$newfile =~ s/\$form->{path}\///;
- &scanfile("$bindir/$newfile", 1) if $newfile !~ /_/;
+ &scanfile("$basedir/$newfile", 1) if $newfile !~ /_/;
}
# is this a sub ?
@@ -305,7 +322,7 @@ sub scanfile {
$locale{$string} = 1;
# is it a submit button before $locale->
- if (/type=submit/i) {
+ if (/type="?submit"?/i) {
$submit{$string} = 1;
}
}