Bug 41216 - Resurrect tt_valid.t
Summary: Resurrect tt_valid.t
Status: Signed Off
Alias: None
Product: Koha
Classification: Unclassified
Component: Test Suite (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low major
Assignee: Jonathan Druart
QA Contact: Testopia
URL:
Keywords:
Depends on: 38720 41217
Blocks:
  Show dependency treegraph
 
Reported: 2025-11-07 12:06 UTC by Jonathan Druart
Modified: 2025-11-07 14:19 UTC (History)
1 user (show)

See Also:
GIT URL:
Initiative type: ---
Sponsorship status: ---
Comma delimited list of Sponsors:
Crowdfunding goal: 0
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments
Bug 41216: Restore tt_valid.t (11.11 KB, patch)
2025-11-07 12:59 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 41216: Try to fix by adding a space between TT tag and attribute (1.56 KB, patch)
2025-11-07 12:59 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 41216: Correctly fix the translation using I18N (2.23 KB, patch)
2025-11-07 12:59 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 41216: Restore tt_valid.t (11.17 KB, patch)
2025-11-07 14:11 UTC, Julian Maurice
Details | Diff | Splinter Review
Bug 41216: Try to fix by adding a space between TT tag and attribute (1.62 KB, patch)
2025-11-07 14:11 UTC, Julian Maurice
Details | Diff | Splinter Review
Bug 41216: Correctly fix the translation using I18N (2.29 KB, patch)
2025-11-07 14:12 UTC, Julian Maurice
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Druart 2025-11-07 12:06:58 UTC

    
Comment 1 Jonathan Druart 2025-11-07 12:59:01 UTC
Created attachment 189316 [details] [review]
Bug 41216: Restore tt_valid.t

HTML1 is gone. Almost...
The previous rule said that we could not have TT tags within HTML tags
because it caused problems with the translation.
It was incorrect.
Bug 38720 removed that rule, and stated that the only problematic use
was a IF with ">".
It was also incorrect.

This one bug states that we cannot have TT tags to construct HTML tags
IF one of the attribute contains a translatable string.
The list of translatable attributes are listed in tmpl_process3.pl.

This patch restores xt/tt_valid.t (and move it to xt/author) and adjust
slightly the test to take into account this last statement.

Test plan:
0. Apply only this first patch
1. Run xt/author/tt_valid.t
=> It fails on mana-subscription-search-result.inc
2. Update po for your prefered language
=> The string "This resource has been reported more than" is not in the
po files

3. Apply the second patch, repeat 1 and 2
=> It still fails: adding a space between the TT tag and the attribute is not enough here
=> The string is picked now! but... install the template and open the
translated version =>

4. Apply the third patch, repeat 1 and 2
=> The tests pass!
=> The string is still picked, install => The template looks good!
Now if you are familiar with Mana you can try to see the translated
string on the UI
Comment 2 Jonathan Druart 2025-11-07 12:59:03 UTC
Created attachment 189317 [details] [review]
Bug 41216: Try to fix by adding a space between TT tag and attribute
Comment 3 Jonathan Druart 2025-11-07 12:59:04 UTC
Created attachment 189318 [details] [review]
Bug 41216: Correctly fix the translation using I18N
Comment 4 Julian Maurice 2025-11-07 13:39:53 UTC
You added a singular version of the text but I don't think it makes sense here, as the warning is displayed only if tr_warning is > 5 (lowWarned)

Other than that, I followed the test plan and it works well.
Comment 5 Jonathan Druart 2025-11-07 14:08:36 UTC
(In reply to Julian Maurice from comment #4)
> You added a singular version of the text but I don't think it makes sense
> here, as the warning is displayed only if tr_warning is > 5 (lowWarned)
> 
> Other than that, I followed the test plan and it works well.

Yes but I don't know what else we can do. We still want to support languages with multiple plurals.
Comment 6 Julian Maurice 2025-11-07 14:10:10 UTC
(In reply to Jonathan Druart from comment #5)
> Yes but I don't know what else we can do. We still want to support languages
> with multiple plurals.

I forgot about that. So it does make sense, even if the singular version is not used
Comment 7 Julian Maurice 2025-11-07 14:11:58 UTC
Created attachment 189328 [details] [review]
Bug 41216: Restore tt_valid.t

HTML1 is gone. Almost...
The previous rule said that we could not have TT tags within HTML tags
because it caused problems with the translation.
It was incorrect.
Bug 38720 removed that rule, and stated that the only problematic use
was a IF with ">".
It was also incorrect.

This one bug states that we cannot have TT tags to construct HTML tags
IF one of the attribute contains a translatable string.
The list of translatable attributes are listed in tmpl_process3.pl.

This patch restores xt/tt_valid.t (and move it to xt/author) and adjust
slightly the test to take into account this last statement.

Test plan:
0. Apply only this first patch
1. Run xt/author/tt_valid.t
=> It fails on mana-subscription-search-result.inc
2. Update po for your prefered language
=> The string "This resource has been reported more than" is not in the
po files

3. Apply the second patch, repeat 1 and 2
=> It still fails: adding a space between the TT tag and the attribute is not enough here
=> The string is picked now! but... install the template and open the
translated version =>

4. Apply the third patch, repeat 1 and 2
=> The tests pass!
=> The string is still picked, install => The template looks good!
Now if you are familiar with Mana you can try to see the translated
string on the UI

Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Comment 8 Julian Maurice 2025-11-07 14:11:59 UTC
Created attachment 189329 [details] [review]
Bug 41216: Try to fix by adding a space between TT tag and attribute

Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Comment 9 Julian Maurice 2025-11-07 14:12:01 UTC
Created attachment 189330 [details] [review]
Bug 41216: Correctly fix the translation using I18N

Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>