Bugzilla – Attachment 76330 Details for
Bug 15395
Internationalization: plural forms, context, and more
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 15395: Fix translation when text contains non-ASCII characters
Bug-15395-Fix-translation-when-text-contains-non-A.patch (text/plain), 2.81 KB, created by
Julian Maurice
on 2018-06-25 06:33:25 UTC
(
hide
)
Description:
Bug 15395: Fix translation when text contains non-ASCII characters
Filename:
MIME Type:
Creator:
Julian Maurice
Created:
2018-06-25 06:33:25 UTC
Size:
2.81 KB
patch
obsolete
>From 773f76a2e9cad0c8d40ef196ae5afa5341c6b535 Mon Sep 17 00:00:00 2001 >From: Julian Maurice <julian.maurice@biblibre.com> >Date: Fri, 22 Jun 2018 16:44:39 +0200 >Subject: [PATCH] Bug 15395: Fix translation when text contains non-ASCII > characters > >msgid, msgid_plural and msgctxt need to be utf8-encoded > >Also, remove call to Locale::Messages->select_package which is not >needed anymore >--- > Koha/I18N.pm | 25 ++++++++++++++++++++++++- > 1 file changed, 24 insertions(+), 1 deletion(-) > >diff --git a/Koha/I18N.pm b/Koha/I18N.pm >index e2b88b7beb..44c47132ff 100644 >--- a/Koha/I18N.pm >+++ b/Koha/I18N.pm >@@ -50,7 +50,6 @@ sub init { > my $cache = Koha::Cache::Memory::Lite->get_instance(); > my $cache_key = 'i18n:initialized'; > unless ($cache->get_from_cache($cache_key)) { >- Locale::Messages->select_package('gettext_pp'); > my @system_locales = grep { chomp; not (/^C/ || $_ eq 'POSIX') } qx/locale -a/; > if (@system_locales) { > # LANG needs to be set to a valid locale, >@@ -86,24 +85,34 @@ sub init { > sub __ { > my ($msgid) = @_; > >+ $msgid = Encode::encode_utf8($msgid); >+ > return _gettext(\&gettext, [ $msgid ]); > } > > sub __x { > my ($msgid, %vars) = @_; > >+ $msgid = Encode::encode_utf8($msgid); >+ > return _gettext(\&gettext, [ $msgid ], %vars); > } > > sub __n { > my ($msgid, $msgid_plural, $count) = @_; > >+ $msgid = Encode::encode_utf8($msgid); >+ $msgid_plural = Encode::encode_utf8($msgid_plural); >+ > return _gettext(\&ngettext, [ $msgid, $msgid_plural, $count ]); > } > > sub __nx { > my ($msgid, $msgid_plural, $count, %vars) = @_; > >+ $msgid = Encode::encode_utf8($msgid); >+ $msgid_plural = Encode::encode_utf8($msgid_plural); >+ > return _gettext(\&ngettext, [ $msgid, $msgid_plural, $count ], %vars); > } > >@@ -114,24 +123,38 @@ sub __xn { > sub __p { > my ($msgctxt, $msgid) = @_; > >+ $msgctxt = Encode::encode_utf8($msgctxt); >+ $msgid = Encode::encode_utf8($msgid); >+ > return _gettext(\&pgettext, [ $msgctxt, $msgid ]); > } > > sub __px { > my ($msgctxt, $msgid, %vars) = @_; > >+ $msgctxt = Encode::encode_utf8($msgctxt); >+ $msgid = Encode::encode_utf8($msgid); >+ > return _gettext(\&pgettext, [ $msgctxt, $msgid ], %vars); > } > > sub __np { > my ($msgctxt, $msgid, $msgid_plural, $count) = @_; > >+ $msgctxt = Encode::encode_utf8($msgctxt); >+ $msgid = Encode::encode_utf8($msgid); >+ $msgid_plural = Encode::encode_utf8($msgid_plural); >+ > return _gettext(\&npgettext, [ $msgctxt, $msgid, $msgid_plural, $count ]); > } > > sub __npx { > my ($msgctxt, $msgid, $msgid_plural, $count, %vars) = @_; > >+ $msgctxt = Encode::encode_utf8($msgctxt); >+ $msgid = Encode::encode_utf8($msgid); >+ $msgid_plural = Encode::encode_utf8($msgid_plural); >+ > return _gettext(\&npgettext, [ $msgctxt, $msgid, $msgid_plural, $count], %vars); > } > >-- >2.17.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 15395
:
45797
|
45798
|
45799
|
46337
|
50023
|
50024
|
50025
|
50026
|
61873
|
61874
|
61875
|
61876
|
61934
|
61935
|
61977
|
62008
|
62041
|
62326
|
62327
|
62328
|
62329
|
62330
|
62331
|
62332
|
62333
|
62335
|
62709
|
65894
|
70974
|
70975
|
70976
|
71940
|
71941
|
71942
|
71943
|
71944
|
71945
|
71946
|
71947
|
71948
|
71949
|
71950
|
71951
|
71952
|
73901
|
73902
|
73903
|
73904
|
73905
|
73906
|
73907
|
73908
|
73909
|
73910
|
73911
|
73912
|
73913
|
76328
|
76329
|
76330
|
77475
|
77476
|
81152
|
81153
|
81154
|
81155
|
81156
|
81157
|
81158
|
81159
|
81167
|
81734
|
81735
|
81736
|
81737
|
81738
|
81739
|
81741
|
81742
|
81743