[Po4a-devel][CVS] po4a/lib/Locale/Po4a Xml.pm,1.13,1.14
by Jordi Vilalta
Update of /cvsroot/po4a/po4a/lib/Locale/Po4a
In directory haydn:/tmp/cvs-serv27778
Modified Files:
Xml.pm
Log Message:
Now the Xml module detects the input document's encoding and substitutes it
by the output document's one
Index: Xml.pm
===================================================================
RCS file: /cvsroot/po4a/po4a/lib/Locale/Po4a/Xml.pm,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- Xml.pm 8 Aug 2004 06:27:51 -0000 1.13
+++ Xml.pm 8 Aug 2004 18:44:56 -0000 1.14
@@ -368,15 +368,17 @@
}
sub tag_trans_xmlhead {
-#TODO
my ($self,@tag)=@_;
-my $tag = $self->join_lines(@tag);
- $tag =~ /^(\S*)(\s*)(.*)/s;
- my ($name,$spaces,$attr)=($1,$2,$3);
- #We get the file encoding
- #my $enc=$self->attribute($attr,"encoding");
- #print $enc."\n";
+ # We don't have to translate anything from here: throw away references
+ my $tag = $self->join_lines(@tag);
+ $tag =~ /encoding=(("|')|)(.*?)(\s|\2)/s;
+ my $in_charset=$3;
+ my $out_charset=$self->detected_charset($in_charset);
+
+ $tag =~ s/$in_charset/$out_charset/
+ unless !defined($out_charset) or $out_charset eq "";
+
return $tag;
}
20 years, 3 months
[Po4a-devel][CVS] po4a Makefile,1.5,1.6 README.tests,1.3,1.4
by Jordi Vilalta
Update of /cvsroot/po4a/po4a
In directory haydn:/tmp/cvs-serv19486
Modified Files:
Makefile README.tests
Log Message:
Added the "bugreport" target in the makefile, and update README.tests to
reflect this new option (it was still talking about Makefile.PL)
Index: README.tests
===================================================================
RCS file: /cvsroot/po4a/po4a/README.tests,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- README.tests 28 Apr 2004 22:02:21 -0000 1.3
+++ README.tests 8 Aug 2004 17:50:37 -0000 1.4
@@ -8,7 +8,7 @@
fix them. At least, provide me the detailed result of the test suite. For
that, run the following command:
- script -c 'perl -V;perl Makefile.PL;make clean test TEST_VERBOSE=1' po4a.log
+ make bugreport
It will produce a file called 'po4a.log', containing most of the details I
need. Please also report all details you think appropriate.
Index: Makefile
===================================================================
RCS file: /cvsroot/po4a/po4a/Makefile,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- Makefile 16 Jul 2004 23:16:23 -0000 1.5
+++ Makefile 8 Aug 2004 17:50:37 -0000 1.6
@@ -16,4 +16,7 @@
stats: Build
@./Build postats
-.PHONY: all install clean dist stats
+bugreport:
+ script -c 'perl -V;perl Build.PL;./Build clean;./Build test verbose=1' po4a.log
+
+.PHONY: all install clean dist stats bugreport
20 years, 3 months
Re: [Po4a-devel]Version 0.17.2 out
by Jordi Vilalta
On Sun, 8 Aug 2004, Martin Quinson wrote:
> On Sun, Aug 08, 2004 at 06:01:21PM +0200, Jordi Vilalta wrote:
>> On Sat, 7 Aug 2004, Martin Quinson wrote:
>>> Thanks for your patience. Now, you are free to break po4a to implement the
>>> encoding or whatever you need ;)
>>
>> I've began doing it (breaking things), and I've scared myself. Now I've
>> almost finished a big part of the encoding issues (I think it's
>> everything, but I'm likely missing something) and I was going to write
>> some tests to convince myself everything was ok. What a surprise when I've
>> seen 8 tests failing (not the ones I wrote). First I thought it was
>> because of the encoding stuff, but then I've seen these are broken since
>> 0.17.1. It seems to be because of the man module fix in that release. Can
>> you please watch it? I'll try to do that the dist target depends on the
>> tests, so that it doesn't happen again.
>
> I'd like to, but the README.tests comes from before the switch to Build.PL,
> and I have no idea of how to make it become more verbose.
>
> If you have any idea, it would save me the documentation dig.
It seems to be ./Build test verbose=1
Now I'll modify README.tests
Regards,
Jordi Vilalta
20 years, 3 months
[Po4a-devel][CVS] po4a/debian changelog,1.71,1.72
by Jordi Vilalta
Update of /cvsroot/po4a/po4a/debian
In directory haydn:/tmp/cvs-serv16482
Modified Files:
changelog
Log Message:
Reflect last change
Index: changelog
===================================================================
RCS file: /cvsroot/po4a/po4a/debian/changelog,v
retrieving revision 1.71
retrieving revision 1.72
diff -u -d -r1.71 -r1.72
--- changelog 7 Aug 2004 23:57:56 -0000 1.71
+++ changelog 8 Aug 2004 16:16:34 -0000 1.72
@@ -1,3 +1,12 @@
+po4a (0.18-1) unstable; urgency=low
+
+ NOT YET RELEASED
+
+ [Jordi Vilalta]
+ - [Build.PL] Ensure we run the tests before distributing a new release
+
+ -- Martin Quinson <martin.quinson(a)tuxfamily.org> Tue, 8 Aug 2004 18:11:00 +0200
+
po4a (0.17.2-1) unstable; urgency=low
[Martin Quinson]
20 years, 3 months
[Po4a-devel][CVS] po4a Build.PL,1.9,1.10
by Jordi Vilalta
Update of /cvsroot/po4a/po4a
In directory haydn:/tmp/cvs-serv15282
Modified Files:
Build.PL
Log Message:
Added the 'test' dependancy to the 'dist' target
Index: Build.PL
===================================================================
RCS file: /cvsroot/po4a/po4a/Build.PL,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- Build.PL 7 Aug 2004 04:53:33 -0000 1.9
+++ Build.PL 8 Aug 2004 16:01:54 -0000 1.10
@@ -209,6 +209,17 @@
}
}
}
+ sub ACTION_dist {
+ my ($self) = @_;
+
+ $self->depends_on('test');
+ $self->depends_on('distdir');
+
+ my $dist_dir = $self->dist_dir;
+
+ $self->make_tarball($dist_dir);
+ $self->delete_filetree($dist_dir);
+ }
sub ACTION_postats {
my $self = shift;
$self->depends_on('binpo');
20 years, 3 months
[Po4a-devel][CVS] po4a/lib/Locale/Po4a Po.pm,1.20,1.21
by Jordi Vilalta
Update of /cvsroot/po4a/po4a/lib/Locale/Po4a
In directory haydn:/tmp/cvs-serv6782
Modified Files:
Po.pm
Log Message:
Gettextization selects a character set for the resulting po depending on how
are the original and the translation encoded.
Index: Po.pm
===================================================================
RCS file: /cvsroot/po4a/po4a/lib/Locale/Po4a/Po.pm,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- Po.pm 8 Aug 2004 06:30:56 -0000 1.20
+++ Po.pm 8 Aug 2004 11:31:07 -0000 1.21
@@ -81,6 +81,7 @@
my %debug=('canonize' => 0,
'quote' => 0,
'escape' => 0,
+ 'encoding' => 1,
'filter' => 1);
=head1 Functions about whole message catalogs
@@ -300,7 +301,19 @@
"po4a gettextize: A possible cause is that a text dupplicated in the original is not translated the same way each time. Remove one of the translations, and you're fine."),
$poorig->count_entries() , $potrans->count_entries())."\n";
}
-
+
+ if ( $poorig->get_charset =~ /^utf-8$/i ) {
+ $potrans->to_utf;
+ $pores->set_charset("utf-8");
+ } else {
+ $pores->set_charset($potrans->get_charset);
+ }
+ print "Po character sets:\n".
+ " original=".$poorig->get_charset."\n".
+ " translated=".$potrans->get_charset."\n".
+ " result=".$pores->get_charset."\n"
+ if $debug{'encoding'};
+
for (my ($o,$t)=(0,0) ;
$o<$poorig->count_entries() && $t<$potrans->count_entries();
$o++,$t++) {
@@ -568,8 +581,8 @@
my $charset = $this->get_charset();
unless ($charset eq "CHARSET" or
- $charset eq "ascii" or
- $charset eq "utf-8") {
+ $charset =~ /^ascii$/i or
+ $charset =~ /^utf-8$/i) {
foreach my $msgid ( keys %{$this->{po}} ) {
Encode::from_to($this->{po}{$msgid}{'msgstr'}, $charset, "utf-8");
}
20 years, 3 months
[Po4a-devel][CVS] po4a po4a-updatepo,1.23,1.24 po4a-gettextize,1.23,1.24
by Jordi Vilalta
Update of /cvsroot/po4a/po4a
In directory haydn:/tmp/cvs-serv20699
Modified Files:
po4a-updatepo po4a-gettextize
Log Message:
New doc paragraph about encodings
Index: po4a-updatepo
===================================================================
RCS file: /cvsroot/po4a/po4a/po4a-updatepo,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- po4a-updatepo 8 Aug 2004 06:48:15 -0000 1.23
+++ po4a-updatepo 8 Aug 2004 07:19:05 -0000 1.24
@@ -37,6 +37,10 @@
languages at once), and several documentation file (if you want to store
the translations of several documents in the same po files).
+If the master document has non-ascii characters, it will convert the po files
+to utf-8 (if they weren't already), in order to allow non-standard characters
+in a culture independent way.
+
=head1 OPTIONS
=over 4
Index: po4a-gettextize
===================================================================
RCS file: /cvsroot/po4a/po4a/po4a-gettextize,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- po4a-gettextize 8 Aug 2004 06:48:15 -0000 1.23
+++ po4a-gettextize 8 Aug 2004 07:19:05 -0000 1.24
@@ -51,6 +51,11 @@
mark all extracted translation as fuzzy, to make sure that the translator
will have a look at them, and detect any remaining problem.
+If the master document has non-ascii characters, the new generated po file
+will be in utf-8, in order to allow non-standard characters in a culture
+independent way. Else (if the master document is completely in ascii), the
+generated po will use the encoding of the translated input document.
+
=head1 OPTIONS
=over 4
20 years, 3 months
[Po4a-devel][CVS] po4a po4a-gettextize,1.22,1.23 po4a-updatepo,1.22,1.23
by Jordi Vilalta
Update of /cvsroot/po4a/po4a
In directory haydn:/tmp/cvs-serv26623
Modified Files:
po4a-gettextize po4a-updatepo
Log Message:
These two seem to be correct. Now let's mess TransTractor up ó_ò
Index: po4a-updatepo
===================================================================
RCS file: /cvsroot/po4a/po4a/po4a-updatepo,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- po4a-updatepo 19 Jul 2004 10:21:12 -0000 1.22
+++ po4a-updatepo 8 Aug 2004 06:48:15 -0000 1.23
@@ -144,6 +144,7 @@
# Parse our options
my (@masterfiles,@pofiles);
my ($help,$help_fmt,$verbose,$debug,$format,@options);
+my $mastchar;
GetOptions('help|h' => \$help,
'help-format' => \$help_fmt,
@@ -151,6 +152,8 @@
'po|p=s' => \@pofiles,
'format|f=s' => \$format,
+ 'master-charset|M=s' => \$mastchar,
+
'option|o=s' => \@options,
'verbose|v' => \$verbose,
@@ -192,18 +195,28 @@
print STDERR gettext("Parse input files... ") if $verbose;
-$doc->process('file_in_name' => \@masterfiles,
- 'po_out_name' => $pot_filename,
- 'debug' => $debug,
- 'verbose' => $verbose);
+$doc->{TT}{utf_mode} = 1;
-print STDERR gettext("done.")."\n" if $verbose;
+$doc->process('file_in_name' => \@masterfiles,
+ 'file_in_charset' => $mastchar,
+ 'po_out_name' => $pot_filename,
+ 'debug' => $debug,
+ 'verbose' => $verbose);
+
+print STDERR gettext("done.")."\n" if $verbose;
while (my $po_filename=shift @pofiles) {
if (-e $po_filename) {
print STDERR sprintf(gettext("Updating %s:"),$po_filename)
if $verbose;
+ # Recode the po file if needed before merging
+ unless ($doc->{TT}{ascii_input}) {
+ my $oldpo = Locale::Po4a::Po->new();
+ $oldpo->read($po_filename);
+ $oldpo->to_utf();
+ $oldpo->write($po_filename);
+ }
system ("msgmerge","-U",$po_filename,$pot_filename) == 0 ||
die sprintf(gettext("Error while running msgmerge: %s"),$!)."\n";
system "msgfmt --statistics -v -o /dev/null $po_filename"
Index: po4a-gettextize
===================================================================
RCS file: /cvsroot/po4a/po4a/po4a-gettextize,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- po4a-gettextize 19 Jul 2004 10:21:12 -0000 1.22
+++ po4a-gettextize 8 Aug 2004 06:48:15 -0000 1.23
@@ -158,18 +158,22 @@
my ($pofile)=('-');
my ($masterfile,$locfile,$help_fmt,$help,$type,$debug,$verbose,@options);
+my ($mastchar,$locchar);
Getopt::Long::config('bundling', 'no_getopt_compat', 'no_auto_abbrev');
GetOptions(
'help|h' => \$help,
'help-format' => \$help_fmt,
-
+
'master|m=s' => \$masterfile,
'localized|l=s' => \$locfile,
'po|p=s' => \$pofile,
'format|f=s' => \$type,
+ 'master-charset|M=s' => \$mastchar,
+ 'localized-charset|L=s' => \$locchar,
+
'option|o=s' => \@options,
-
+
'verbose|v' => \$verbose,
'debug|d' => \$debug,
'version|V' => \&show_version
@@ -202,8 +206,10 @@
my ($mastertt,$transtt)=(Locale::Po4a::Chooser::new($type,%options),
Locale::Po4a::Chooser::new($type,%options));
-# Parse master file
+# Parse master file forcing conversion to utf if it's not in ascii
$mastertt->read($masterfile);
+$mastertt->{TT}{utf_mode} = 1;
+$mastertt->{TT}{file_in_charset} = $mastchar;
$mastertt->parse;
@@ -214,6 +220,9 @@
# We have to merge two transtractor files
$transtt->read($locfile);
+ # We force the conversion to utf if the master document wasn't in ascii
+ $transtt->{TT}{utf_mode} = !$mastertt->{TT}{ascii_input};
+ $transtt->{TT}{file_in_charset} = $locchar;
$transtt->parse;
my $mergedpo = Locale::Po4a::Po->gettextize($mastertt->getpoout(),
20 years, 3 months
[Po4a-devel][CVS] po4a/lib/Locale/Po4a Po.pm,1.19,1.20
by Jordi Vilalta
Update of /cvsroot/po4a/po4a/lib/Locale/Po4a
In directory haydn:/tmp/cvs-serv23028
Modified Files:
Po.pm
Log Message:
Added a new function that recodes the whole po to utf (needed by the future
po4a-update)
Index: Po.pm
===================================================================
RCS file: /cvsroot/po4a/po4a/lib/Locale/Po4a/Po.pm,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- Po.pm 7 Aug 2004 04:51:33 -0000 1.19
+++ Po.pm 8 Aug 2004 06:30:56 -0000 1.20
@@ -74,6 +74,8 @@
use Locale::gettext qw(dgettext);
use File::Path; # mkdir before write
+use Encode;
+
my @known_flags=qw(wrap no-wrap c-format fuzzy);
my %debug=('canonize' => 0,
@@ -551,6 +553,28 @@
if (apply($msgid,$msgstr,$ref,$flags,$comment,$automatic)); # DO NOT CHANGE THE ORDER
}
return $res;
+}
+
+=item to_utf()
+
+This recodes all the msgstrs in the po from the character set specified in the
+header to utf-8. This process is only ignored if the header character set is
+"CHARSET" (unspecified, usually means ascii), "ascii" or "utf-8".
+
+=cut
+
+sub to_utf {
+ my $this = shift;
+ my $charset = $this->get_charset();
+
+ unless ($charset eq "CHARSET" or
+ $charset eq "ascii" or
+ $charset eq "utf-8") {
+ foreach my $msgid ( keys %{$this->{po}} ) {
+ Encode::from_to($this->{po}{$msgid}{'msgstr'}, $charset, "utf-8");
+ }
+ $this->set_charset("utf-8");
+ }
}
=back
20 years, 3 months
[Po4a-devel][CVS] po4a/lib/Locale/Po4a Xml.pm,1.12,1.13
by Jordi Vilalta
Update of /cvsroot/po4a/po4a/lib/Locale/Po4a
In directory haydn:/tmp/cvs-serv22927
Modified Files:
Xml.pm
Log Message:
Enhance documentation and fix a syntax error
Index: Xml.pm
===================================================================
RCS file: /cvsroot/po4a/po4a/lib/Locale/Po4a/Xml.pm,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- Xml.pm 7 Aug 2004 04:51:33 -0000 1.12
+++ Xml.pm 8 Aug 2004 06:27:51 -0000 1.13
@@ -778,7 +778,7 @@
}
}
- die sprintf("po4a::xml: ".dgettext ("po4a","Bad attribute syntax at %s"),$ref)."\n";
+ die sprintf("po4a::xml: ".dgettext ("po4a","Bad attribute syntax at %s"),$ref)."\n"
unless ($complete);
}
}
@@ -1014,8 +1014,9 @@
=item skip_spaces
-This function receives as argument the pointer to a paragraph (in the format
-returned by get_string_until) and skips his heading spaces.
+This function receives as argument the reference to a paragraph (in the format
+returned by get_string_until), skips his heading spaces and returns them as
+a simple string.
=cut
20 years, 3 months