Bug 27816

Summary: "Click to edit" in Point of sale is untranslatable
Product: Koha Reporter: Caroline Cyr La Rose <caroline.cyr-la-rose>
Component: I18N/L10NAssignee: Owen Leonard <oleonard>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: trivial    
Priority: P5 - low CC: andrew, f.demians, fridolin.somers, martin.renvoize, oleonard
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
21.05.00,20.11.04
Circulation function:
Attachments: Bug 27816: "Click to edit" in Point of sale is untranslatable
Bug 27816: "Click to edit" in Point of sale is untranslatable

Description Caroline Cyr La Rose 2021-02-26 19:20:07 UTC
The "Click to edit" prompt in "This sale" in the point of sale is untranslatable.

To reproduce:
1- Enable EnablePointOfSale syspref
2- Enable UseCashRegisters syspref
3- Set up at least one cash register in Administration > Cash registers
4- Set up at least one Debit type that can be sold through POS in Administration > Debit types
5- Install at least one other language in your staff interface and switch to that language
6- Go to Point of sale and click Add next to one item for purchase
7- On the right hand side where the purchased item is added, click on the price to change it
8- Remove all digits; the click to edit prompt appears in English

Is is the same for the Quantity.

I checked po/fr-CA-staff-prog.po, po/fr-CA-messages.po and po/fr-CA-messages-js.po and the only "Click to edit" is in the preferences.
Comment 1 Katrin Fischer 2021-03-13 15:35:28 UTC
Hm, I had a look into fixing this, but it seems to come from here:

koha-tmpl/intranet-tmpl/lib/datatables/datatables.js:            *          "defaultContent": "Click to edit"

I am not sure how to deal with the string in the datatables library.
Comment 2 Owen Leonard 2021-03-15 17:30:26 UTC
Created attachment 118251 [details] [review]
Bug 27816: "Click to edit" in Point of sale is untranslatable

This patch adds an option to the Point of sale jEditable configuration
to explicitly set the title attribute to "Click to edit." This will
allow the string to be picked up for translation.

To test, apply the patch and test that the correct string is
translated. In this example I'm testing fr-FR:

  - Update a translation:

    > cd misc/translator
    > perl translate update fr-FR

  The "Click to edit" string should already have been translated, so
  it's not necessary to update the .po file.

  - Install the updated translation:

    > perl translate install fr-FR

In the staff interface, switch to the language you're testing and open
the point of sale page. Add some items for purchase. They should appear
in the "This sale" table. Hover your mouse over the values in the "Coût"
and "Quantité" columns. You should see the translated string, "Cliquer
pour modifier."
Comment 3 Martin Renvoize (ashimema) 2021-03-15 17:34:20 UTC
Nice, thanks Owen, I hadn't got to working out where the magic happens for this one yet ﷐[U+1F600]﷑
Comment 4 Martin Renvoize (ashimema) 2021-03-15 17:34:44 UTC
Nice, thanks Owen, I hadn't got to working out where the magic happens for this one yet ﷐[U+1F600]﷑
Comment 5 Martin Renvoize (ashimema) 2021-03-16 14:36:10 UTC
Created attachment 118327 [details] [review]
Bug 27816: "Click to edit" in Point of sale is untranslatable

This patch adds an option to the Point of sale jEditable configuration
to explicitly set the title attribute to "Click to edit." This will
allow the string to be picked up for translation.

To test, apply the patch and test that the correct string is
translated. In this example I'm testing fr-FR:

  - Update a translation:

    > cd misc/translator
    > perl translate update fr-FR

  The "Click to edit" string should already have been translated, so
  it's not necessary to update the .po file.

  - Install the updated translation:

    > perl translate install fr-FR

In the staff interface, switch to the language you're testing and open
the point of sale page. Add some items for purchase. They should appear
in the "This sale" table. Hover your mouse over the values in the "Coût"
and "Quantité" columns. You should see the translated string, "Cliquer
pour modifier."

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 6 Martin Renvoize (ashimema) 2021-03-16 14:36:36 UTC
Works perfectly.. going for a straight QA on this one.
Comment 7 Jonathan Druart 2021-03-18 14:06:50 UTC
Pushed to master for 21.05, thanks to everybody involved!
Comment 8 Fridolin Somers 2021-03-22 09:55:54 UTC
Small useful enhancement, I choose to backport.

Pushed to 20.11.x for 20.11.04
Comment 9 Andrew Fuerste-Henry 2021-03-23 19:20:30 UTC
Enhancement, not backported to 20.05
Comment 10 Katrin Fischer 2021-03-23 21:59:12 UTC
(In reply to Andrew Fuerste-Henry from comment #9)
> Enhancement, not backported to 20.05

Actually a bug - fixed the status.