[Bug 43946] New: Classes picked for translation in XSLT
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43946 Bug ID: 43946 Summary: Classes picked for translation in XSLT Initiative type: --- Sponsorship --- status: Product: Koha Version: unspecified Hardware: All OS: All Status: NEW Severity: major Priority: P5 - low Component: Templates Assignee: jonathan.druart@gmail.com Reporter: jonathan.druart@gmail.com QA Contact: testopia@bugs.koha-community.org Target Milestone: --- in koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl `<xsl:attribute name="class">subject</xsl:attribute>` "subject" is picked for translation. The class for the `a` element is then translated and OPACPopupAuthorsSearch is broken. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43946 Jonathan Druart <jonathan.druart@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43946 --- Comment #1 from Jonathan Druart <jonathan.druart@gmail.com> --- Created attachment 209817 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=209817&action=edit Bug 43946: Do not translate the subject and contributors CSS classes - OPAC XSLT In <xsl:attribute name="class">subject</xsl:attribute> "subject" is picked for translation. In es-ES, "subject" becomes "asunto", in fr-FR "sujet" => XSLT outputs class="asunto" opac-detail.tt has its JS looking for ".contributors,.subject" and so finds nothing => the popup never opens. Test plan: 1. Install a translation, e.g. es-ES, and update the po files 2. Open an OPAC detail page of a record with subjects and contributors 3. Click a subject or contributor link => Without this patch the popup does not open in es-ES or fr-FR => With this patch it does -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43946 --- Comment #2 from Jonathan Druart <jonathan.druart@gmail.com> --- Created attachment 209818 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=209818&action=edit Bug 43946: Don't translate literal attribute values in XSLT stylesheets I have asked Claude to search for other occurrences: The translator extracts the text of <xsl:attribute> and of the <xsl:text> it contains as translatable strings. Translators then translate values that are not user-facing but are consumed by CSS, JS, browsers or parsers, e.g. class="title", class="OpenURL", class="rtl", class="fa fa-search", target="_blank", dir="rtl", the RDFa property/typeof/resource values, rel="gb_page_center[600,500]", and the type/authority attributes of the MODS and MADS outputs. Use xsl:value-of with a string literal instead, as already done for the "record" class, so these values are no longer extracted. User-facing attributes (title, alt, aria-label) are left untouched. Test plan: 1. Install a translation, e.g. es-ES, and update the po files 2. Check the OPAC and staff detail and results pages: the generated HTML must still have class="title", target="_blank", class="rtl", dir="rtl", etc. and the translated templates must not contain translated values 3. Confirm these values are no longer in the generated marc po files Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43946 David Nind <david@davidnind.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=43946 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #209817|0 |1 is obsolete| | Attachment #209818|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43946 --- Comment #3 from David Nind <david@davidnind.com> --- Created attachment 210045 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=210045&action=edit Bug 43946: Do not translate the subject and contributors CSS classes - OPAC XSLT In <xsl:attribute name="class">subject</xsl:attribute> "subject" is picked for translation. In es-ES, "subject" becomes "asunto", in fr-FR "sujet" => XSLT outputs class="asunto" opac-detail.tt has its JS looking for ".contributors,.subject" and so finds nothing => the popup never opens. Test plan: 1. Install a translation, e.g. es-ES, and update the po files 2. Open an OPAC detail page of a record with subjects and contributors 3. Click a subject or contributor link => Without this patch the popup does not open in es-ES or fr-FR => With this patch it does Signed-off-by: David Nind <david@davidnind.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43946 --- Comment #4 from David Nind <david@davidnind.com> --- Created attachment 210046 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=210046&action=edit Bug 43946: Don't translate literal attribute values in XSLT stylesheets I have asked Claude to search for other occurrences: The translator extracts the text of <xsl:attribute> and of the <xsl:text> it contains as translatable strings. Translators then translate values that are not user-facing but are consumed by CSS, JS, browsers or parsers, e.g. class="title", class="OpenURL", class="rtl", class="fa fa-search", target="_blank", dir="rtl", the RDFa property/typeof/resource values, rel="gb_page_center[600,500]", and the type/authority attributes of the MODS and MADS outputs. Use xsl:value-of with a string literal instead, as already done for the "record" class, so these values are no longer extracted. User-facing attributes (title, alt, aria-label) are left untouched. Test plan: 1. Install a translation, e.g. es-ES, and update the po files 2. Check the OPAC and staff detail and results pages: the generated HTML must still have class="title", target="_blank", class="rtl", dir="rtl", etc. and the translated templates must not contain translated values 3. Confirm these values are no longer in the generated marc po files Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: David Nind <david@davidnind.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43946 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |david@davidnind.com --- Comment #5 from David Nind <david@davidnind.com> --- I've signed off, but some examples for the second patch would make it much easier to test (for example, an example record and some before and after HTML that shows what is changed when you use Inspect or the Web Developer Tools). Testing notes (using KTD): 1. Set the OPACPopupAuthorsSearch system preference to "Show": - Notes: . If there is only one subject term then there is no pop-up window . If there is only one author (for example, just one "By" author and no "Contributor(s)") . If you click on the magnifying glass/search icon next to the author or term, then there is no pop-up window - you are doing a direct search 2. Install a translation: koha-translate --install fr-FR --dev kohadev 3. Restart everything: restart_all 4. Set these system preferences: - OPACLanguages: select the language you installed - opaclanguagesdisplay: set to "Allow" - StaffInterfaceLanguages: select the language you installed 5. An example record to look at in the OPAC to reproduce the problem: - Programming the Perl DBI (13) - If you inspect the HTML, for example: right click on Perl (Computer program language) - <a class="Sujet".... - After the patch, the correct class name is used: <a class="subject"... 6. After applying the patches, to update the translations: - gulp po:update --lang fr-FR - koha-translate --update fr-FR --dev kohadev - Restart everything: restart_all 7. To get back into a clean state: - cd misc/translator/po - git clean -fd - git reset --hard origin/main - git status - cd /kohadevbox/koha - git checkout main - git branch -D [yourbranchname] - git reset --hard origin/main - git clean -fd - reset_all -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org