Bugzilla – Attachment 105074 Details for
Bug 25501
Encoding issues in the translation process
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 25501: Pass the encoding to Locale::PO
Bug-25501-Pass-the-encoding-to-LocalePO.patch (text/plain), 3.98 KB, created by
Jonathan Druart
on 2020-05-19 10:31:34 UTC
(
hide
)
Description:
Bug 25501: Pass the encoding to Locale::PO
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2020-05-19 10:31:34 UTC
Size:
3.98 KB
patch
obsolete
>From 6f0adadd389f78c5d59291568d3858063742339e Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 19 May 2020 12:11:37 +0200 >Subject: [PATCH] Bug 25501: Pass the encoding to Locale::PO > >--- > misc/translator/LangInstaller.pm | 10 +++++----- > misc/translator/po2json | 2 +- > misc/translator/tmpl_process3.pl | 2 +- > t/LangInstaller.t | 2 +- > 4 files changed, 8 insertions(+), 8 deletions(-) > >diff --git a/misc/translator/LangInstaller.pm b/misc/translator/LangInstaller.pm >index 79180cc64e..1872e89922 100644 >--- a/misc/translator/LangInstaller.pm >+++ b/misc/translator/LangInstaller.pm >@@ -310,7 +310,7 @@ sub save_po { > $po->{''} ||= $default_pref_po_header; > > # Write .po entries into a file put in Koha standard po directory >- Locale::PO->save_file_fromhash( $self->po_filename("-pref.po"), $po ); >+ Locale::PO->save_file_fromhash( $self->po_filename("-pref.po"), $po, 'utf-8' ); > say "Saved in file: ", $self->po_filename("-pref.po") if $self->{verbose}; > } > >@@ -323,7 +323,7 @@ sub get_po_merged_with_en { > my $po_current = $self->{po}; > > # Get po from previous generation >- my $po_previous = Locale::PO->load_file_ashash( $self->po_filename("-pref.po") ); >+ my $po_previous = Locale::PO->load_file_ashash( $self->po_filename("-pref.po"), 'utf-8' ); > > for my $id ( keys %$po_current ) { > my $po = $po_previous->{Locale::PO->quote($id)}; >@@ -572,7 +572,7 @@ sub create_installer { > # create output file only if there is something to write > if ( $po ) { > my $po_file = $self->po_filename( $target->{suffix} ); >- Locale::PO->save_file_fromhash( $po_file, $po ); >+ Locale::PO->save_file_fromhash( $po_file, $po, 'utf-8' ); > say "Saved in file: ", $po_file if $self->{verbose}; > } > } >@@ -593,7 +593,7 @@ sub update_installer { > if ( $po ) { > my ( $fh, $po_temp ) = tempfile(); > binmode( $fh, ":encoding(UTF-8)" ); >- Locale::PO->save_file_fromhash( $po_temp, $po ); >+ Locale::PO->save_file_fromhash( $po_temp, $po, 'utf-8' ); > my $po_file = $self->po_filename( $target->{suffix} ); > eval { > my $st = system($self->{msgmerge}." ".($self->{verbose}?'':'-q'). >@@ -612,7 +612,7 @@ sub translate_yaml { > my $po_file = $self->po_filename( $target->{suffix} ); > return $srcyml unless ( -e $po_file ); > >- my $po_ref = Locale::PO->load_file_ashash( $po_file ); >+ my $po_ref = Locale::PO->load_file_ashash( $po_file, 'utf-8' ); > > my $dstyml = LoadFile( $srcyml ); > >diff --git a/misc/translator/po2json b/misc/translator/po2json >index 2f534bead3..c73dd711b6 100755 >--- a/misc/translator/po2json >+++ b/misc/translator/po2json >@@ -67,7 +67,7 @@ sub main > > my $plural_form_count; > # get po object stack >- my $pos = Locale::PO->load_file_asarray($src) or die "Can't parse po file [$src]."; >+ my $pos = Locale::PO->load_file_asarray($src, 'utf-8') or die "Can't parse po file [$src]."; > > > foreach my $po (@$pos) >diff --git a/misc/translator/tmpl_process3.pl b/misc/translator/tmpl_process3.pl >index f6241882b5..9cc85a8702 100755 >--- a/misc/translator/tmpl_process3.pl >+++ b/misc/translator/tmpl_process3.pl >@@ -303,7 +303,7 @@ for my $in_dir ( @in_dirs ) { > } > > # restores the string list from file >-$href = Locale::PO->load_file_ashash($str_file); >+$href = Locale::PO->load_file_ashash($str_file, 'utf-8'); > > # guess the charsets. HTML::Templates defaults to iso-8859-1 > if (defined $href) { >diff --git a/t/LangInstaller.t b/t/LangInstaller.t >index 6e122b368e..f621a0f291 100644 >--- a/t/LangInstaller.t >+++ b/t/LangInstaller.t >@@ -50,7 +50,7 @@ EOF > . "-o $tempdir/Koha.pot -D $tempdir koha-tmpl/intranet-tmpl/simple.tt"; > > system($xgettext_cmd); >- my $pot = Locale::PO->load_file_asarray("$tempdir/Koha.pot"); >+ my $pot = Locale::PO->load_file_asarray("$tempdir/Koha.pot", 'utf-8'); > > my @expected = ( > { >-- >2.20.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 25501
:
104876
|
105043
|
105060
|
105067
|
105073
|
105074
|
105080
|
105081
|
105084
|
105085
|
105095
|
105099