Cannot translate strings handled by fieldmapper

Bug #1078596 reported by Pasi Kallinen
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Evergreen
Fix Released
Undecided
Unassigned
2.2
Fix Released
Undecided
Unassigned
2.3
Fix Released
Undecided
Unassigned

Bug Description

We have (practically) a complete Evergreen translation to Finnish. Problem is that some strings that have been translated show only the English string in the staff client. Looking at the source code, it seems all strings going through fieldmapper show only the english string.

Attached is a screenshot of the patron registration screen; note how "Verify Password" and "Parent/Guardian" are translated, but the rest of the field names aren't.

Revision history for this message
Pasi Kallinen (paxed) wrote :
Revision history for this message
Pasi Kallinen (paxed) wrote :

Some more information:

"Verify Password" and "Parent/Guardian" are handled specially in the load() function in var/web/js/ui/default/actor/user/register.js:

  dojo.byId('parentGuardian').innerHTML = localeStrings.PARENT_OR_GUARDIAN;

Whereas all the other (non-translatable) strings are handled in fleshFMRow():

   var fieldIdl = fieldmapper.IDL.fmclasses[fmcls].field_map[fmfield];
...
   ltd.appendChild(document.createTextNode(fieldIdl.label));

Revision history for this message
Pasi Kallinen (paxed) wrote :

Changing the locales in eg_vhost.conf to fi-FI doesn't help either.

Revision history for this message
Pasi Kallinen (paxed) wrote :

Even more information:

In Open-ILS/web/js/dojo/fieldmapper/IDL.js, line 17 says:
    if (!fieldmapper.IDL.fmclasses) fieldmapper.IDL.fmclasses = {};
and then in line 35:
    if(!fieldmapper.IDL.fmclasses || blahblah...

That should also check fieldmapper.IDL.fmclasses.length

Doing this, translated strings in patron registration work... Except for the field labels under "User Settings" -part, which are still in english., as the User Settings labels go through different route:

In Open-ILS/src/sql/Pg/950.data.seed-values.sql, shouldn't these have oils_i18n_gettext() stuff:

INSERT INTO config.usr_setting_type (name,opac_visible,label,description,datatype) VALUES ('opac.default_pickup_location', TRUE, 'Default Hold Pickup Location', 'Default location for holds pickup', 'integer');

I haven't tried changing the db inserts.

Revision history for this message
Pasi Kallinen (paxed) wrote :

Attached is patch against git HEAD, fixing the fieldmapper problem with i18n. See my previous comment for explanation.

Revision history for this message
Pasi Kallinen (paxed) wrote :

And now, a properly formed patch, with Signed-off-by.

Changed in evergreen:
status: New → Triaged
Revision history for this message
Jason Stephenson (jstephenson) wrote :

Pasi,

You should see about getting a ssh public key added to the working Evergreen git repository:

http://www.open-ils.org/dokuwiki/doku.php?id=dev:git

This will ease the flow of your future contributions to Evergreen.

Thanks!

Revision history for this message
Dan Scott (denials) wrote :

Pasi: thanks very much for the patch!

I have tested it, and found that out of the box the Apache configuration that controls which language the fm_IDL.xml is displayed in is badly broken. So I pushed an extra commit to http://git.evergreen-ils.org/?p=working/Evergreen.git;a=shortlog;h=refs/heads/user/dbs/lp1078596_fmidl_i18n to fix the out-of-the-box Apache configuration.

Testers of this commit need to build a locale other than en-US (say xx-YY), ensure that /openils/var/web/opac/locale/xx-YY/fm_IDL.dtd exists, then view the contents of fm_IDL.xml via curl to see if the translated strings show up:

# English
 curl -H "Accept-Language:en-US" localhost/reports/fm_IDL.xml

# French
 curl -H "Accept-Language:fr-CA" localhost/reports/fm_IDL.xml

... etc.

Revision history for this message
Dan Scott (denials) wrote :

Hmm. I also needed to add:

                        headers : {"Accept-Language":OpenSRF.locale},

to the dojo.xhrGet request() to ensure that Apache receives the header that it needs to serve up the right language for fm_IDL.xml.

I pushed another commit to the branch and also removed the misleading comments about i18n support for fm_IDL.xml.

Revision history for this message
Dan Scott (denials) wrote :

(Note that the last commit isn't strictly necessary for the staff client, which already munges Accept-Language, but would be necessary for any normal browser that tries to use dojo.fieldmapper.IDL).

Revision history for this message
Pasi Kallinen (paxed) wrote :
Revision history for this message
Dan Scott (denials) wrote :

Thanks Pasi! I have pushed the lot to master, rel_2_3, and rel_2_2. I bet a lot of sites will be happy about this change... thanks again for your work on it!

Changed in evergreen:
milestone: none → 2.4.0-alpha
status: Triaged → Fix Committed
Ben Shum (bshum)
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.