Bug 36837 - XSLT CSS classes offered for translations
Summary: XSLT CSS classes offered for translations
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: I18N/L10N (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low normal (vote)
Assignee: Tomás Cohen Arazi
QA Contact: Martin Renvoize
URL:
Keywords:
Depends on: 30554
Blocks:
  Show dependency treegraph
 
Reported: 2024-05-13 13:09 UTC by Tomás Cohen Arazi
Modified: 2024-05-30 19:38 UTC (History)
5 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
24.05.00,23.11.06


Attachments
Bug 36837: Simplify XSLT and aid translatability (14.43 KB, patch)
2024-05-13 14:01 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 36837: Simplify XSLT and aid translatability (14.49 KB, patch)
2024-05-13 14:40 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 36837: (follow-up) UNIMARC case (1.99 KB, patch)
2024-05-13 15:11 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Tomás Cohen Arazi 2024-05-13 13:09:38 UTC
I was translating and found 'authority-summary' for translation. Did

```shell
$ git grep authority-summary
koha-tmpl/intranet-tmpl/prog/en/includes/authorities-search-results.inc:      <div class="authority-summary">
koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21authResults.xsl:                <xsl:text>authority-summary</xsl:text>
koha-tmpl/intranet-tmpl/prog/en/xslt/UNIMARCauthResults.xsl:        <xsl:text>authority-summary</xsl:text>
koha-tmpl/intranet-tmpl/prog/en/xslt/UNIMARCauthResults.xsl:      <!-- end div class authority-summary-->
koha-tmpl/opac-tmpl/bootstrap/en/includes/authorities-search-results.inc:        <div class="authority-summary">
```

The next one was `authref` but it all follows the same pattern of being a <xsl:text> node.
Comment 1 Tomás Cohen Arazi 2024-05-13 14:01:13 UTC
Created attachment 166643 [details] [review]
Bug 36837: Simplify XSLT and aid translatability

This patch makes the XSLT contain HTML tags instead of building them
from scratch with static attribute values. This made it awkward for
translators as CSS classes ended up being extracted for translation
purposes. Plus, there's no need to spend CPU cycles on static content
generation.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 2 Martin Renvoize 2024-05-13 14:40:22 UTC
Created attachment 166647 [details] [review]
Bug 36837: Simplify XSLT and aid translatability

This patch makes the XSLT contain HTML tags instead of building them
from scratch with static attribute values. This made it awkward for
translators as CSS classes ended up being extracted for translation
purposes. Plus, there's no need to spend CPU cycles on static content
generation.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 3 Martin Renvoize 2024-05-13 14:41:18 UTC
I see no reason these should have been getting built by the xsl processing.. they're not using variables etc.

More than happy with the patch, no regressions found.

Going straight for a PQA here.
Comment 4 Tomás Cohen Arazi 2024-05-13 15:11:58 UTC
Created attachment 166649 [details] [review]
Bug 36837: (follow-up) UNIMARC case

I checked the UNIMARC authResults counterpart file. And it only
contained a single case of generated elements like the previous patch.

To test:
1. On latest main
   $ ktd --shell
  k$ cd misc/translator/po
  k$ git fetch
  k$ git reset --hard origin/main
  k$ cd /kohadevbox/koha
  k$ gulp po:update --lang es-ES
  k$ cd misc/translator/po
  k$ git add -u ; git commit -mWIP --no-verify
2. Apply this patches
3. Run:
  k$ cd /kohadevbox/koha
  k$ gulp po:update --lang es-ES
  k$ cd misc/translator/po
  k$ git diff
=> SUCCESS: Notice CSS class names are not translated anymore

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 5 Katrin Fischer 2024-05-14 13:35:28 UTC
Pushed for 24.05!

Well done everyone, thank you!
Comment 6 Fridolin Somers 2024-05-29 12:35:42 UTC
Pushed to 23.11.x for 23.11.06
Comment 7 Lucas Gass 2024-05-30 19:38:18 UTC
Doesn't apply cleanly to 23.05.x, no backport.