TPAC needs a locale picker

Bug #1025921 reported by Dan Scott
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Evergreen
Fix Released
Undecided
Unassigned
2.2
Fix Released
Undecided
Unassigned

Bug Description

* Evergreen master / 2.2

There is currently no good way for users to change their preferred locale in TPAC. They can change their browser language preference, but it's cumbersome and almost nobody does, and that's still problematic for shared workstations (like at public libraries). They could also set an eg_locale cookie for the given hostname in their browser, which is even less likely. So we need to provide users with a less painful way to switch locales.

The ideal solution will:

1) Only show the locale picker if multiple locales are available. No sense in cluttering the screen display if there's no choice to be made!

2) Display the list of locales in their localized form (for example, "English (Canada)", "français (Canada)", "español (España)", etc).

3) Make the setting sticky so that the user doesn't have to change their setting each browser session (for example, set the eg_locale cookie expiry time way into the future)

4) Not impact the performance of the TPAC (for example, don't query the database on each page load just to get the translated versions of each locale name; cache that!)

5) Immediately reload the current page without losing any context. For example, if I share a link to a given page of search results, the recipient should be able to pick a different locale and get the same results displayed in their preferred locale.

6) Have a design that is accessible, does not require Javascript, and does not suck. One option might be to, in the absence of any detected locale preference, display a locale selection page (similar to what gc.ca and aircanada.com do), and then tuck the locale picker in a less conspicuous location.

7) Have the locale picker selection default to the currently selected locale.

Towards that end, user/dbs/tpac_i18n_cookie in working is making progress. Not there yet, but I'd be delighted if others wanted to build on it. Right now it follows an approach similar to the JSPAC, in that the locale picker is on every page on the top right. We also need to address #2 and fix #5; the CSS for #6 could be improved, and #7 appears to be a bit browser-dependent at the moment.

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

Force-pushed an updated branch that (I think) addresses #2 and #5.

Note that this branch consists of two commits; the last commit simply fixes a problem with the translation parser that meant that any non-ASCII data was getting garbled.

Therefore, please merge the top two commits in user/dbs/tpac_i18n_cookie !

tags: added: pullrequest
Changed in evergreen:
milestone: none → 2.3.0-beta1
Revision history for this message
Lebbeous Fogle-Weekley (lebbeous) wrote :

Hi Dan. So I've spent longer (much longer) than I thought I would need to test this. I'd never installed other locales with Evergreen before. After doing that and uncommenting these lines in eg_vhost.conf:

    PerlAddVar OILSWebLocale "fr_ca"
    PerlAddVar OILSWebLocale "/openils/var/data/locale/messages.fr_ca.po"

I got your dropdown to appear. It seems to behave as advertised as far as setting the eg_locale cookie and all that, but my TPAC remains in English. I assume there is an fr-CA translation of it, so I don't know what I've done wrong. I'd like to sign off on this, but somebody who knows what they're doing with translations may have to take this to the finish line.

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

Force-pushed a merge w/conflict fix for current master to user/dbs/tpac_i18n_cookie

As for your problem with locale, I had to use the xx-YY version of the locale name in the PO file to match the xx-YY locale naming convention of the rest of OpenSRF & Evergreen; for example:

PerlAddVar OILSWebLocale "fr_ca"
PerlAddVar OILSWebLocale "/openils/var/templates/locale/tpac.fr-CA.po"

Revision history for this message
George Duimovich (george-duimovich) wrote :

Just for clarification, what would be the recommended way to support a locally modified official translation?

I suppose we could just overwrite (and/or add) entries in "tpac.fr-CA.po", but these would be overwritten with each upgrade.

Is there a similar "local" approach (as per JSPac) that could work something like this (where tpac_local.fr-CA.po contains just new or locally revised translations, etc.?

PerlAddVar OILSWebLocale "fr_ca"
PerlAddVar OILSWebLocale "/openils/var/templates/locale/tpac.fr-CA.po"
PerlAddVar OILSWebLocale "/openils/var/templates/locale/tpac_local.fr-CA.po"

Thanks for working on this..

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

George - please keep questions like this to the mailing list. Even though we're talking about translations and TPAC in this bug, your question is off-topic here, as we're focused on a particular set of functionality.

Revision history for this message
Lebbeous Fogle-Weekley (lebbeous) wrote :

Aha.

Tried again with this new information, and now my TPAC parle français. I am now comfortable with signing off and merging, so doing so now.

Thanks Dan!

Changed in evergreen:
status: New → 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.