User Tools

Site Tools


i18n:problem_children

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
i18n:problem_children [2008/01/20 08:15] – created dbsi18n:problem_children [2025/08/02 18:08] (current) – Removing outdated XUL client information; adding Launchpad links sleary
Line 1: Line 1:
 +======Internationalization challenges======
  
 +See [[https://bugs.launchpad.net/evergreen/+bugs?field.tag=i18n|the i18n tag on Launchpad]] for open bugs related to internationalization and localization.
 +
 +=====Unfriendly Forms====
 +
 +A few forms are designed as "fill in the blank" English sentences, which won't translate well. 
 +
 +See [[https://bugs.launchpad.net/evergreen/+bug/1178557|#1178557 Short translatable strings need context]]
 +
 +=====MARC editor suggestions=====
 +There is a giant file of field labels for the MARC editor that has been generated from the Library of Congress electronic MARC21 documentation. Where translated versions of the MARC21 standard are available, we will have to create scripts to parse and build the equivalent translations. Depending on the license of the translated work, the translations may not be able to be distributed as part of Evergreen and may have to be built by each Evergreen site instead (unless an Evergreen vendor negotiates a redistribution license with the copyright owner):
 +
 +  * [[http://www.loc.gov/marc/translations.html|List of MARC translations]]
 +  * [[http://www.lac-bac.gc.ca/marc/040010-1000-f.html|fr-CA translation]] - electronic, yay
 +
 +
 +=====Hard-coded locales in application code=====
 +
 +Need to check for and correct code like the following in ''Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm'':
 +<code perl>
 + if ($format eq 'opac') {
 + print "Location: $root/../../en-US/skin/default/xml/rresult.xml?m=$id\n\n"
 + if ($type eq 'metarecord');
 + print "Location: $root/../../en-US/skin/default/xml/rdetail.xml?r=$id\n\n"
 + if ($type eq 'record');
 + return 302;
 +
 + }
 +</code>
 +Something like the following may work:
 +<code bash>
 +find Open-ILS/src -exec grep -H "en-US" {} \;
 +</code>
 +
 +//[ We need to teach Apache to pass the locale to mod_perl handlers (maybe it can already? %ENV is fine) and move supercat under /opac/{locale}/extras. Then a simple global replace. :) -- miker ]//
 +
 +=====Calendar widgets=====
 +
 +See [[https://bugs.launchpad.net/evergreen/+bug/2114944|#2114944 OPAC datepicker translations]]
 +
 +=====Logic relying on parsing English text=====
 +From ''Open-ILS/xul/server/circ/checkout.js'':
 +<code javascript>
 + 'check_date' : function(node) {
 + JSAN.use('util.date');
 + try {
 + if (node.value == 'Normal') return true;
 + var pattern = node.value.match(/Today \+ (\d+) days/);
 + if (pattern) {
 + var today = new Date();
 + var todayPlus = new Date(); todayPlus.setTime( today.getTime() + 24*60*60*1000*pattern[1] );
 + node.value = util.date.formatted_date(todayPlus,"%F");
 + }
 + if (! util.date.check('YYYY-MM-DD',node.value) ) { throw('Invalid Date'); }
 + if (util.date.check_past('YYYY-MM-DD',node.value) ) { throw('Due date needs to be after today.'); }
 + if ( util.date.formatted_date(new Date(),'%F') == node.value) { throw('Due date needs to be after today.'); }
 + return true;
 + } catch(E) {
 + throw(E);
 + }
 + },
 +</code>
 +The problem here is that we're running a regex against an English string. A couple of approaches to solving this problem:
 +  * One regex per locale (brittle, perhaps, and requires regex knowledge that the average translator probably won't have)
 +  * Create a parallel hidden node that contains the English string and parse that instead, while the localized version is displayed (a bit tricky, but doesn't change the fundamental logic being used)
 +  * Set the value as an attribute of the node and parse that instead (possibly using a simple math notation like ''+30'').
 +
 +===== Hardcoded strings in Perl modules =====
 +
 +[[http://svn.open-ils.org/trac/ILS/browser/trunk/Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm|OpenILS::WWW::SuperCat]] contains hardcoded strings and locales for the slimcat and extras (bookbags, etc). For example:<code perl>
 +sub bookbag_feed {
 +...
 + if ($type eq 'opac') {
 + print "Location: $root/../../en-US/skin/default/xml/rresult.xml?rt=list&" .
 + join('&', map { "rl=" . $_->target_biblio_record_entry } @{ $bucket->items }) .
 + "\n\n";
 + return 302;
 + }
 +...
 + $feed->title("Items in Book Bag [".$bucket->name."]");
 +...
 + $feed->link(
 + OPAC =>
 + '/opac/en-US/skin/default/xml/rresult.xml?rt=list&' .
 + join('&', map { 'rl=' . $_->target_biblio_record_entry } @{$bucket->items} ),
 + 'text/html'
 + );
 +}
 +</code>
 +
 +=====Org Unit shortnames=====
 +Some code invokes the ''.shortname()'' method of an actor_org_unit object to get a short code that uniquely identifies a particular org unit and uses that for display purposes. We should audit these sections of code to find out where the shortname is being displayed directly to the user and try to replace it with the full name, where possible (keeping the shortname hidden for invoking methods if necessary). For example, in ''Open-ILS/xul/server/circ/util.js'': <code javascript>
 +'render' : function(my) {
 +    if (my.circ) {
 +        return data.hash.aou[ my.circ.circ_lib() ].shortname();
 +    } else {
 +        if (my.acp.circulations()) {
 +            return data.hash.aou[ my.acp.circulations()[0].circ_lib() ].shortname();
 +        } else {
 +            return "";
 +        }
 +    }</code>

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki

© 2008-2022 GPLS and others. Evergreen is open source software, freely licensed under GNU GPLv2 or later.
The Evergreen Project is a U.S. 501(c)3 non-profit organization.