When there are items marked es "Not for loan" by the item type in the result list in OPAC, the "Not for loan" text doesn't translate.
The problem is somewhere around here: https://git.koha-community.org/Koha-community/Koha/src/branch/master/C4/XSLT.pm#L396 I think it was assumed that you'd usually have a description stemming from the authorised value, but this is not the case when the itemtype determines that the item is Not for loan. We need to have this string translatable. I am currently out of ideas on how to fix this :(
*** Bug 32008 has been marked as a duplicate of this bug. ***
This got worse with the rewrites/changes in the newer versions. The string "Not for loan" is no longer in its own HTML element, so it's not longer a simple search and replace by jQuery as a workaround. It's now much more difficult as it has the library name in the same element. <span class="unavailable_Not for loan"><span class="ItemBranch">Bibliothek X: Not for loan</span> (1). </span> The problem is here: https://git.koha-community.org/Koha-community/Koha/src/branch/master/C4/XSLT.pm#L339 Can please someone help to fix this?
Will have a look here soon.
Thanks Marcel, I tried, but I have run out of ideas and the code is a little complex.
Looking here now
Bumping here again on the lack of translated auth values ..
(In reply to Marcel de Rooy from comment #7) > Bumping here again on the lack of translated auth values .. But this is not coming from an authorised value in that case... It's the fallback text for the itemtype level setting that's failing.
(In reply to Katrin Fischer from comment #8) > (In reply to Marcel de Rooy from comment #7) > > Bumping here again on the lack of translated auth values .. > > But this is not coming from an authorised value in that case... It's the > fallback text for the itemtype level setting that's failing. Sure. But it's the same code or direct context in the .xsl
Cleared up on IRC: the item type value will be translated, but the AV values will not. With this fix we can still have at least all translated one non-English language which often will help already.
Example display Availability: Items available for loan: Centerville (1)Call number: PERL A 1. Items available for reference: Centerville: NOT FOR LOAN (1)Call number: PERL A 4. Centerville: Staff collection (1)Call number: PERL A 5. Not available: Centerville: Damaged (1)Call number: PERL A 3. Centerville: Withdrawn (1)Call number: PERL A 2. # Toggling NFL statuses Availability: Items available for loan: Centerville (1)Call number: PERL A 1. Items available for reference: Centerville: NOT FOR LOAN (1)Call number: PERL A 4. Not available: Centerville: Damaged (1)Call number: PERL A 3. Centerville: Staff collection (1)Call number: PERL A 5. Centerville: Withdrawn (1)Call number: PERL A 2. # Toggling NFL statuses Availability: Items available for loan: Centerville (1)Call number: PERL A 1. Items available for reference: Centerville: Staff collection (1)Call number: PERL A 5. Not available: Centerville: Damaged (1)Call number: PERL A 3. Centerville: NOT FOR LOAN (1)Call number: PERL A 4. Centerville: Withdrawn (1)Call number: PERL A 2.
Clarification: uc NOT FOR LOAN is the translation :)
Created attachment 149919 [details] [review] Bug 30352: Allow translation of Not for loan in OPAC XSLT results Note: Test plan below can be followed in English. If you would like to see the vernacular results, you need to update PO files and translate 'Not for loan', and update templates (xslt files) accordingly. The bootstrap PO does not yet include that string without %s suffix in the current codebase. Test plan: [1] Apply this patch and make the following change in MARC21slim2OPACResults.xsl, line 1207. Change: <status english="Not for loan">Not for loan</status> to: <status english="Not for loan">NOT for loan</status> Important: Change text inside, not the attribute! Restart all. [2] Pick a biblio, add some items with different statuses: Checked out, Damaged, Not for loan, Staff collection. [3] Make it appear in a OPAC results display (not detail). [4] You should see the different statuses, including NOT for loan. The uppercase NOT serves to prove that the string has been translated. Also verify that you see Staff collection as-is. [5] Bonus: Toggle with values in Reference_NFL_Statuses to move results from Reference section to Not available section v.v. [6] Revert the change from step 1. Sign off :) Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Created attachment 149920 [details] [review] Bug 30352: Add a comment to the substatus translation The tric of combining the XPath union operator (|) with the value-of instruction works as a sort of ternary operation. The value-of only picks the string value of the first node from the union in document order. So, if there is a translation, it will be the first node. If there is no translation, the original substatus will be used. Note that there will be no translation for authorised values like Staff collection, etc. Test plan: None. Just comments. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Created attachment 150107 [details] [review] Bug 30352: Allow translation of Not for loan in OPAC XSLT results Note: Test plan below can be followed in English. If you would like to see the vernacular results, you need to update PO files and translate 'Not for loan', and update templates (xslt files) accordingly. The bootstrap PO does not yet include that string without %s suffix in the current codebase. Test plan: [1] Apply this patch and make the following change in MARC21slim2OPACResults.xsl, line 1207. Change: <status english="Not for loan">Not for loan</status> to: <status english="Not for loan">NOT for loan</status> Important: Change text inside, not the attribute! Restart all. [2] Pick a biblio, add some items with different statuses: Checked out, Damaged, Not for loan, Staff collection. [3] Make it appear in a OPAC results display (not detail). [4] You should see the different statuses, including NOT for loan. The uppercase NOT serves to prove that the string has been translated. Also verify that you see Staff collection as-is. [5] Bonus: Toggle with values in Reference_NFL_Statuses to move results from Reference section to Not available section v.v. [6] Revert the change from step 1. Sign off :) Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: David Nind <david@davidnind.com>
Created attachment 150108 [details] [review] Bug 30352: Add a comment to the substatus translation The tric of combining the XPath union operator (|) with the value-of instruction works as a sort of ternary operation. The value-of only picks the string value of the first node from the union in document order. So, if there is a translation, it will be the first node. If there is no translation, the original substatus will be used. Note that there will be no translation for authorised values like Staff collection, etc. Test plan: None. Just comments. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: David Nind <david@davidnind.com>
Testing notes (using KTD): 1. For step 1 of the test plan: . to edit file: vi koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults.xsl . line to edit for me was 1297 2. Second patch: I don't know enough to provide a useful comment, feel free to change the status back to needs signoff for someone else to comment if this is essential.
Created attachment 150121 [details] [review] Bug 30352: Allow translation of Not for loan in OPAC XSLT results Note: Test plan below can be followed in English. If you would like to see the vernacular results, you need to update PO files and translate 'Not for loan', and update templates (xslt files) accordingly. The bootstrap PO does not yet include that string without %s suffix in the current codebase. Test plan: [1] Apply this patch and make the following change in MARC21slim2OPACResults.xsl, line 1207. Change: <status english="Not for loan">Not for loan</status> to: <status english="Not for loan">NOT for loan</status> Important: Change text inside, not the attribute! Restart all. [2] Pick a biblio, add some items with different statuses: Checked out, Damaged, Not for loan, Staff collection. [3] Make it appear in a OPAC results display (not detail). [4] You should see the different statuses, including NOT for loan. The uppercase NOT serves to prove that the string has been translated. Also verify that you see Staff collection as-is. [5] Bonus: Toggle with values in Reference_NFL_Statuses to move results from Reference section to Not available section v.v. [6] Revert the change from step 1. Sign off :) Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Created attachment 150122 [details] [review] Bug 30352: Add a comment to the substatus translation The tric of combining the XPath union operator (|) with the value-of instruction works as a sort of ternary operation. The value-of only picks the string value of the first node from the union in document order. So, if there is a translation, it will be the first node. If there is no translation, the original substatus will be used. Note that there will be no translation for authorised values like Staff collection, etc. Test plan: None. Just comments. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Thanks Marcel. I also verified that this is working by running the translation scripts and updating the po files. We now see a translated Not for loan according to selected language.
(In reply to Katrin Fischer from comment #20) > Thanks Marcel. > > I also verified that this is working by running the translation scripts and > updating the po files. We now see a translated Not for loan according to > selected language. Great, thx.
Pushed to master for 23.05. Nice work everyone, thanks!
Many hands makes light work, thankyou everyone! Pushed to 22.11.x for the next release
Backported to 22.05.x for upcoming 22.05.13
This was pushed to 21.11. And I think it broke search results display in 21.11.x.
I have now reverted this two patches on 21.11, to be released as 21.11.22. If needed in 21.11, we can give it proper testing and make sure nothing is broken.