[Date Prev][Date Next][Thread Prev][Thread Next][Thread Index]
[XaraXtreme-commits] Commit Complete
Commit by : alex
Repository : xara
Revision : 1209
Date : Tue May 30 10:25:17 BST 2006
Changed paths:
M /Trunk/XaraLX/Scripts/build-resources.pl
M /Trunk/XaraLX/wxOil/Makefile.am
Added flag to control generation of internationalized resources
Diff:
Index: Trunk/XaraLX/Scripts/build-resources.pl
===================================================================
--- Trunk/XaraLX/Scripts/build-resources.pl (revision 1208)
+++ Trunk/XaraLX/Scripts/build-resources.pl (revision 1209)
@@ -23,6 +23,10 @@
-x - setting of XARALANGUAGE
-n / --version x.y - set version to x.y ; omit to prevent svnversion
build
+ -i | --international- build internationalisation resources ; omit to
+ prevent wxrc / xgettext etc usage
+ --xgettext PATH - pass alternate path to xgettext
+ --wxrc PATH - pass alternate path to wxrc
--verbose - be very loud about it
--user - setting of USERNAME
--help - display this message
@@ -58,7 +62,6 @@
my %tabtableplace;
my %tabtabledup;
-my $checksum="md5sum";
my $xaralanguage="EN";
my $xgettext="xgettext";
my $wxrc="wxrc";
@@ -67,17 +70,18 @@
my $topdir=".";
my $version="";
my $user="unknown";
+my $international=0;
GetOptions( "topdir|t=s" => \$topdir,
"ouputdir|o=s" => \$outputdir,
- "force!" => \$force,
+ "force|f!" => \$force,
+ "international|i!" => \$international,
"verbose|v+" => \$verbose,
"version|n=s" => \$version,
"user|u=s" => \$user,
"xaralanguage|x=s" => \$xaralanguage,
- "wxrc=s" => \$wxrc,
- "xgettext|g=s" => \$xgettext,
- "checksum=s" => \$checksum,
+ "wxrc=s" => \$wxrc,
+ "xgettext|g=s" => \$xgettext,
"help!" => \$help ) || usage ("Bad option");
usage() if ($help);
@@ -323,68 +327,68 @@
$ret=system("$topdir/Scripts/combinexrc.pl","-b","missing.png","-t","-s","-o","$outputdir/xrc/strings.lst",@xrcfiles);
die "Failed to combine strings ($ret): $!" if ($ret);
-my @strings;
-open(STRINGS,"$outputdir/xrc/strings.lst") || die "Could not open strings.lst: $!";
-while (<STRINGS>)
+if ($international)
{
- chomp;
- s/^\S+ //;
- # escape slashes
- s/\/\\/g;
- # escape quotes
- s/\"/\\"/g;
- my $s;
- $s="_(\"$_\");";
- push @strings, $s;
- print STDERR "String: $s
" if ($verbose>2);
+ my @strings;
+ open(STRINGS,"$outputdir/xrc/strings.lst") || die "Could not open strings.lst: $!";
+ while (<STRINGS>)
+ {
+ chomp;
+ s/^\S+ //;
+ # escape slashes
+ s/\/\\/g;
+ # escape quotes
+ s/\"/\\"/g;
+ my $s;
+ $s="_(\"$_\");";
+ push @strings, $s;
+ print STDERR "String: $s
" if ($verbose>2);
+ }
+ close(STRINGS);
+
+ open(DIALOGS,"$wxrc -g $outputdir/xrc/dialogs.xrc|") || die "Could not read dialogs for translation: $!";
+ while (<DIALOGS>)
+ {
+ # Note wxrc removes XML escaping
+ chomp;
+ print STDERR "Dialog: $_
" if ($verbose>2);
+ push @strings,$_;
+ }
+
+ my @uniqstrings;
+ my $last="";
+ foreach $i (sort @strings)
+ {
+ next if ($i eq $last);
+ $last = $i;
+ my $j;
+ $j=$i;
+ next if ($j =~ /^_\(\"\"\)\;\s+$/);
+ $j=~s/\r\n/\n/g;
+ # strings.lst is still XML escaped. We want to remove the XML escaping here - we add C escaping to BOTH
+ # later
+ # We should use proper XML unquoting here - AMB to fix - could use HTML::Entities if it's around
+ # Handle quoted numbers
+ my $c;
+ $j=~s/(&\#(\d+);?)/$2 < 256 ? chr($2) : $1/eg;
+ $j=~s/(&\#[xX]([0-9a-fA-F]+);?)/$c = hex($2); $c < 256 ? chr($c) : $1/eg;
+ $j=~s/</\</g;
+ $j=~s/>/\>/g;
+ $j=~s/"/\"/g;
+ $j=~s/&/\&/g;
+ push @uniqstrings, $j;
+ }
+
+ my $n=1;
+ open (XGETTEXT, "|".$xgettext.' --from-code ISO-8859-1 --force-po -k_ -C -i - --no-location --copyright-holder "Xara Group Ltd" --msgid-bugs-address=bugs@xxxxxxxx -d xaralx -o '.$outputdir."/xrc/xaralx.po") || die "Can't run $xgettext: $!";
+ foreach $i (@uniqstrings)
+ {
+ print STDERR "Line $n, translate: $i
" if ($verbose>2);
+ $n++;
+ print XGETTEXT "$i
";
+ }
}
-close(STRINGS);
-open(DIALOGS,"$wxrc -g $outputdir/xrc/dialogs.xrc|") || die "Could not read dialogs for translation: $!";
-while (<DIALOGS>)
-{
- # Note wxrc removes XML escaping
- chomp;
- print STDERR "Dialog: $_
" if ($verbose>2);
- push @strings,$_;
-}
-
-my @uniqstrings;
-my $last="";
-foreach $i (sort @strings)
-{
- next if ($i eq $last);
- $last = $i;
- my $j;
- $j=$i;
- next if ($j =~ /^_\(\"\"\)\;\s+$/);
- $j=~s/\r\n/\n/g;
- # strings.lst is still XML escaped. We want to remove the XML escaping here - we add C escaping to BOTH
- # later
- # We should use proper XML unquoting here - AMB to fix - could use HTML::Entities if it's around
- # Handle quoted numbers
- my $c;
- $j=~s/(&\#(\d+);?)/$2 < 256 ? chr($2) : $1/eg;
- $j=~s/(&\#[xX]([0-9a-fA-F]+);?)/$c = hex($2); $c < 256 ? chr($c) : $1/eg;
- $j=~s/</\</g;
- $j=~s/>/\>/g;
- $j=~s/"/\"/g;
- $j=~s/&/\&/g;
- push @uniqstrings, $j;
-}
-
-if ($xgettext ne "skip")
-{
- my $n=1;
- open (XGETTEXT, "|".$xgettext.' --from-code ISO-8859-1 --force-po -k_ -C -i - --no-location --copyright-holder "Xara Group Ltd" --msgid-bugs-address=bugs@xxxxxxxx -d xaralx -o '.$outputdir."/xrc/xaralx.po") || die "Can't run $xgettext: $!";
- foreach $i (@uniqstrings)
- {
- print STDERR "Line $n, translate: $i
" if ($verbose>2);
- $n++;
- print XGETTEXT "$i
";
- }
-}
-
# Write the file to the wrong directory (deliberate)
open(CHECK,">$outputdir/xrc/$xaralanguage/xrc.check") || die "Could not write xrc.check: $!";
print CHECK "$checksum
";
Index: Trunk/XaraLX/wxOil/Makefile.am
===================================================================
--- Trunk/XaraLX/wxOil/Makefile.am (revision 1208)
+++ Trunk/XaraLX/wxOil/Makefile.am (revision 1209)
@@ -41,4 +41,4 @@
XARALANGUAGE = @XARALANGUAGE@
-RESOURCEDUMMY := ${if ${strip ${shell $(TOPDIR)/Scripts/build-resources.pl -t $(TOPDIR) -o . --version $(VERSION) -x $(XARALANGUAGE) -u $(USER) } }, ,${error "Resource build failed"}}
+RESOURCEDUMMY := ${if ${strip ${shell $(TOPDIR)/Scripts/build-resources.pl -i -t $(TOPDIR) -o . --version $(VERSION) -x $(XARALANGUAGE) -u $(USER) } }, ,${error "Resource build failed"}}
Xara