[Bug 30991] New: [% ELSE %]0[% END %] will break translations if used for assigning variables
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30991 Bug ID: 30991 Summary: [% ELSE %]0[% END %] will break translations if used for assigning variables Change sponsored?: --- Product: Koha Version: unspecified Hardware: All OS: All Status: NEW Severity: normal Priority: P5 - low Component: I18N/L10N Assignee: koha-bugs@lists.koha-community.org Reporter: katrin.fischer@bsz-bw.de QA Contact: testopia@bugs.koha-community.org CC: frederic@tamil.fr See bug 30958 and bug 23713: The construct with the 0 will break on translation as it's removed in the translated templates:
The problematic line (below) in the English template is: var OD_password_required = [% IF Koha.Preference('OverDrivePasswordRequired') %]1[% ELSE %]0[% END %];
Which is translated to the following in the en-NZ (and other languages) template: var OD_password_required = [% IF Koha.Preference('OverDrivePasswordRequired') %]1[% ELSE %][% END %];
We should verify that there are not more occurences of the bad pattern or improve our translation scripts: (In reply to Owen Leonard from comment #3)
There are a couple of other instances that I saw which should also be addressed. I searched the NZ templates for "1[% ELSE %][% END %]"
-- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30991 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=30958 -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30991 --- Comment #1 from Alex Buckley <alexbuckley@catalyst.net.nz> --- Created attachment 136408 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=136408&action=edit Bug 30991: Fix remaining instances of [% ELSE %]0[% END %] in templates The construct of [% ELSE %]0[% END %] breaks translations as it is translated as [% ELSE %][% END %]. Note: No 0 in the ELSE statement. This patchset either removes occurances of a lone 0 in template ELSE statements, or splits it over multiple lines so the 0 is not removed in the translated templates. Test plan: 1. Install the en-NZ translation 2. Search the translated templates for '[% ELSE %][% END %]' and confirm there are are instances of that 3. Apply patch 4. Update your en-NZ translation 5. Repeat step 2 and confirm there are no more instances of [% ELSE %][% END %] in the translated templates Note: I removed the [% ELSE %] statement from opac-bottom.inc as that statement was empty in the en translation so it didn't look to be needed. Sponsored-by: Catalyst IT, New Zealand -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30991 Alex Buckley <alexbuckley@catalyst.net.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |alexbuckley@catalyst.net.nz |ity.org | Change sponsored?|--- |Sponsored Status|NEW |Needs Signoff CC| |alexbuckley@catalyst.net.nz -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30991 Lucas Gass <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30991 Lucas Gass <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #136408|0 |1 is obsolete| | --- Comment #2 from Lucas Gass <lucas@bywatersolutions.com> --- Created attachment 136429 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=136429&action=edit Bug 30991: Fix remaining instances of [% ELSE %]0[% END %] in templates The construct of [% ELSE %]0[% END %] breaks translations as it is translated as [% ELSE %][% END %]. Note: No 0 in the ELSE statement. This patchset either removes occurances of a lone 0 in template ELSE statements, or splits it over multiple lines so the 0 is not removed in the translated templates. Test plan: 1. Install the en-NZ translation 2. Search the translated templates for '[% ELSE %][% END %]' and confirm there are are instances of that 3. Apply patch 4. Update your en-NZ translation 5. Repeat step 2 and confirm there are no more instances of [% ELSE %][% END %] in the translated templates Note: I removed the [% ELSE %] statement from opac-bottom.inc as that statement was empty in the en translation so it didn't look to be needed. Sponsored-by: Catalyst IT, New Zealand Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30991 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Patch complexity|--- |Small patch Status|Signed Off |Passed QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30991 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #136429|0 |1 is obsolete| | --- Comment #3 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Created attachment 136554 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=136554&action=edit Bug 30991: Fix remaining instances of [% ELSE %]0[% END %] in templates The construct of [% ELSE %]0[% END %] breaks translations as it is translated as [% ELSE %][% END %]. Note: No 0 in the ELSE statement. This patchset either removes occurances of a lone 0 in template ELSE statements, or splits it over multiple lines so the 0 is not removed in the translated templates. Test plan: 1. Install the en-NZ translation 2. Search the translated templates for '[% ELSE %][% END %]' and confirm there are are instances of that 3. Apply patch 4. Update your en-NZ translation 5. Repeat step 2 and confirm there are no more instances of [% ELSE %][% END %] in the translated templates Note: I removed the [% ELSE %] statement from opac-bottom.inc as that statement was empty in the en translation so it didn't look to be needed. Sponsored-by: Catalyst IT, New Zealand Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30991 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=30569 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30991 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)| |22.11.00 released in| | Status|Passed QA |Pushed to master -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30991 --- Comment #4 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Pushed to master for 22.11. Nice work everyone, thanks! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30991 Lucas Gass <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to master |Pushed to stable CC| |lucas@bywatersolutions.com Version(s)|22.11.00 |22.11.00, 22.05.04 released in| | --- Comment #5 from Lucas Gass <lucas@bywatersolutions.com> --- Backported to 22.05.x for 22.05.04 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30991 Arthur Suzuki <arthur.suzuki@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |arthur.suzuki@biblibre.com --- Comment #6 from Arthur Suzuki <arthur.suzuki@biblibre.com> --- conflicts when trying to apply to 21.11.x. please provide backport if needed. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30991 Jonathan Druart <jonathan.druart+koha@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jonathan.druart+koha@gmail. | |com --- Comment #7 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- I do understand what we are doing on bug 23713. But here we are simply splitting the rule on different lines. That is not fixing the problem in the long term. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30991 --- Comment #8 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- I mean, it's not solid for future changes, another author can put the statement back on one line. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30991 --- Comment #9 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- (In reply to Jonathan Druart from comment #8)
I mean, it's not solid for future changes, another author can put the statement back on one line.
Maybe this would be a little more solid? - var OD_password_required = [% IF Koha.Preference('OverDrivePasswordRequired') %]1[% ELSE %]0[% END %]; + [%- IF Koha.Preference('OverDrivePasswordRequired') -%] + var OD_password_required = 1; + [%- ELSE -%] + var OD_password_required = 0; + [%- END -%] I have an open issue with those 0 too: Bug 31563 - Numbers on claims tab not showing in translated templates -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30991 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=31563 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30991 --- Comment #10 from David Cook <dcook@prosentient.com.au> --- Comment on attachment 136554 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=136554 Bug 30991: Fix remaining instances of [% ELSE %]0[% END %] in templates Review of attachment 136554: --> (https://bugs.koha-community.org/bugzilla3/page.cgi?id=splinter.html&bug=30991&attachment=136554) ----------------------------------------------------------------- ::: koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt @@ +1307,5 @@
+ [%- IF Koha.Preference('OverDrivePasswordRequired') -%] + var OD_password_required = 1; + [%- ELSE -%] + var OD_password_required = 0; + [%- END -%]
I know it's after the fact, but would something like the following be a viable alternative with the translation tools? var OD_password_required = [% IF Koha.Preference('OverDrivePasswordRequired'); '1'; ELSE; '0'; END; %]; -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org