Bug 30991 - [% ELSE %]0[% END %] will break translations if used for assigning variables
Summary: [% ELSE %]0[% END %] will break translations if used for assigning variables
Status: Pushed to master
Alias: None
Product: Koha
Classification: Unclassified
Component: I18N/L10N (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low normal (vote)
Assignee: Alex Buckley
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-06-17 20:49 UTC by Katrin Fischer
Modified: 2022-06-25 18:31 UTC (History)
2 users (show)

See Also:
Change sponsored?: Sponsored
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
22.11.00


Attachments
Bug 30991: Fix remaining instances of [% ELSE %]0[% END %] in templates (7.79 KB, patch)
2022-06-22 10:05 UTC, Alex Buckley
Details | Diff | Splinter Review
Bug 30991: Fix remaining instances of [% ELSE %]0[% END %] in templates (7.84 KB, patch)
2022-06-22 20:37 UTC, Lucas Gass
Details | Diff | Splinter Review
Bug 30991: Fix remaining instances of [% ELSE %]0[% END %] in templates (7.84 KB, patch)
2022-06-25 15:59 UTC, Katrin Fischer
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Katrin Fischer 2022-06-17 20:49:04 UTC
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 %]"
Comment 1 Alex Buckley 2022-06-22 10:05:37 UTC
Created attachment 136408 [details] [review]
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
Comment 2 Lucas Gass 2022-06-22 20:37:35 UTC
Created attachment 136429 [details] [review]
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>
Comment 3 Katrin Fischer 2022-06-25 15:59:51 UTC
Created attachment 136554 [details] [review]
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>
Comment 4 Tomás Cohen Arazi 2022-06-25 18:31:33 UTC
Pushed to master for 22.11.

Nice work everyone, thanks!