Alert message in Open-ILS/web/js/ui/default/opac/holds-validation.js is not translatable

Bug #1710512 reported by Jason Stephenson
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Evergreen
Fix Released
Medium
Unassigned
2.12
Fix Released
Medium
Unassigned

Bug Description

Evergreen Version: Master
OpenSRF Version: Master
PostgreSQL Version: 9.5

While working on some holds-related code, I noticed that Open-ILS/web/js/ui/default/opac/holds-validation.js creates an alert with a hard-coded English string: "Please complete hold notification method info."

This js file does not pass through tt2 or any other mechanism that I am aware of to internationalize this message string.

My development was leading me to add another string to that file, but I hesitate to do so until these strings can be internationalized.

Revision history for this message
Ben Shum (bshum) wrote :

This string was apparently introduced with the new development in bug 1098685

Changed in evergreen:
status: New → Confirmed
importance: Undecided → Medium
milestone: none → 3.0-alpha
Revision history for this message
Cesar V (cesardv) wrote :

I originally added that string when my intent for bug 1098685 was to be able to just use html5 form validation, and only fallback to this basic plain-vanilla JS for older browsers that did not support it.
But it was decided to just keep it plain vanilla js for validation in the OPAC.

Currently, I am not aware of the method that EG is using to I18n-ize any string that's part of a separate js file used on the OPAC.

However, from what I've gathered a solution would be to have perhaps a i18n_js_strings.tt2 file and inline a <script> tag with a global js blob and push i18n'd string values into the JS of the OPAC, so these translations can take place. Similar to how Open-ILS/src/templates/staff/base_js.tt2 works for the webstaff client.

Not sure how optimal this solution is, but I'm open to any ideas...

Revision history for this message
Cesar V (cesardv) wrote :
Cesar V (cesardv)
tags: added: pullrequest
Revision history for this message
Jason Stephenson (jstephenson) wrote :

That will work in this specific case, but it is not suitable for strings that need to change dynamically at run time via JavaScript. I'm thinking of a string I'd like to add where the string has a number value that changes depending on the user's selection in a list box.

I am not saying this should not go in.--Time permitting, I'll load this today.--I do think we need a real solution for the long term. Perhaps JQuery or Angular could help?

Revision history for this message
Cesar V (cesardv) wrote :

Jason, correct me if I'm wrong, but I was under the impression we were explicitly avoiding using js libs like jQuery, let alone angular in the OPAC/TPAC, which is where I thought this was aimed at...

Revision history for this message
Jason Stephenson (jstephenson) wrote :

Cesar, we are until bug 1642086 goes in. Then, I think it is OK to use jQuery.

Revision history for this message
Cesar V (cesardv) wrote :

Ah ok, thanks Jason, I didn't know about that. Would be great to have jQuery on the OPAC

Revision history for this message
Jason Stephenson (jstephenson) wrote :

I merged this with my 2.12 customization branch, and it works for me. I added my signoff in a collab branch:

http://git.evergreen-ils.org/?p=working/Evergreen.git;a=shortlog;h=refs/heads/collab/dyrcona/lp1710512-OPAC_i18n_js_strings_signoff

Since there is no test plan, I think more signoffs are required. This should also be backported to 2.12 for 2.12.6.

tags: added: signedoff
Galen Charlton (gmc)
Changed in evergreen:
assignee: nobody → Galen Charlton (gmc)
Revision history for this message
Galen Charlton (gmc) wrote :

Verified that 'cd build/i18n && make newpot' produced sensible results. Pushed to master and rel_2_12, along with a POT update for rel_2_12. Thanks, Cesar and Jason!

Changed in evergreen:
assignee: Galen Charlton (gmc) → nobody
status: Confirmed → Fix Committed
Changed in evergreen:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.