Bug 35933 - Do not translate text nodes in xsl:attribute and other tags
Summary: Do not translate text nodes in xsl:attribute and other tags
Status: In Discussion
Alias: None
Product: Koha
Classification: Unclassified
Component: I18N/L10N (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-01-29 15:29 UTC by Kevin Carnes
Modified: 2024-01-29 21:11 UTC (History)
3 users (show)

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


Attachments
Bug 35933: Do not translate text nodes in xsl:attribute and other tags (2.17 KB, patch)
2024-01-29 15:35 UTC, Kevin Carnes
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Kevin Carnes 2024-01-29 15:29:45 UTC
Koha extracts text from text nodes and makes them available for translators to translate. This can cause problems when the text needs to be the same for all languages. For example, when an HTML tag is built using XSLT, the values of its attributes should not be translated.

One solution is to put the text in a xsl:value-of element instead of a text node. This patch is a quick test to see if there is a more general solution. When entering certain tags it treats text nodes as CDATA (it's also possible to make it a COMMENT, UNKNOWN, or a new token type).

It increments and decrements the status to try and handle nested tags, but it might be necessary to make a more robust solution.

Is there interest in developing this solution further? Are there cases where text should be translated in xsl:attribute?
Comment 1 Kevin Carnes 2024-01-29 15:35:36 UTC
Created attachment 161599 [details] [review]
Bug 35933: Do not translate text nodes in xsl:attribute and other tags

To test:
1. Install another language
2. Notice that MARC21slim2OPACDetail.xsl has translated attributes
3. Apply patch
4. Install the language again
5. Notice that only non-attributes are translated