[OPEN-ILS-GENERAL] How to translate facet labels in Evergreen 2.1.1?

Linda Jansova skolkova at chello.cz
Sun Dec 4 14:32:16 EST 2011


Dan, thanks a lot for your quick and precise answer :-)! We have 
followed your recommendations and succeeded in making facets look 
correct in Czech - as you can see in the attached picture :-).

One more tiny little question - is it possible to translate the 
"More..." button which appears in case more items belonging to facets 
are available, yet not presented to the user straightaway?

Linda

Dne 4.12.2011 18:25, Dan Scott napsal(a):
> Hi Linda:
>
> 2011/12/4 Linda Jansova<skolkova at chello.cz>:
>> Dear all,
>>
>> This time we would like to ask a translation-related question. We would like
>> to have expressions such as "Corporate Author" which are used as facet
>> labels when displaying search results translated into Czech (the attached
>> screenshot shows these facets). We have found out that these labels seem to
>> reside in /openils/var/web/opac/common/js/cs-CZ# ls
>> FacetDefs.js OrgTree.js. Any ideas how to translate these?
> Yep, just went through that for fr-CA a few weeks back. These labels
> are maintained in the database - so you need to provide translations
> for the terms in the database, then run "autogen.sh" to regenerate the
> JS files. Normally we would pull the latest translations from
> translations.launchpad.net/evergreen before creating the Evergreen
> release tarball and this should all just work (through the "psql -f
> Open-ILS/src/sql/Pg/950.data.seed-values-cs-CZ.sql -d evergreen"
> approach to populate the database -- you'll get ERROR messages on
> attempts to insert entries that already exist but that's fine -- then
> "autogen.sh").
>
> But if you need to tweak individual entries or add missing ones,
> here's a slightly deeper explanation:
>
> So, let's start with the labels for metabib classes ("Keyword",
> "Title", "Author", etc).
>
> The config.metabib_class is defined in fm_IDL.xml with the class ID
> "cmc", a primary field of "name", and a translatable field of "label"
> (oils_persist:i18n="true").
>
> Let's see what is in config.metabib_class currently:
>
> SELECT * FROM config.metabib_class;
>      name    |   label
> ------------+------------
>   keyword    | Keyword
>   title      | Title
>   author     | Author
>   subject    | Subject
>   series     | Series
>   identifier | Identifier
> (6 rows)
>
> And then let's see what we can find in the database translations for
> config.metabib_class (doing the lookup by the class ID + primary
> field):
>
> SELECT * FROM config.i18n_core WHERE translation = 'fr-CA' AND
> fq_field = 'cmc.name';
>
>    id  | fq_field | identity_value | translation |   string
> ------+----------+----------------+-------------+-------------
>   1758 | cmc.name | keyword        | fr-CA       | Mot-cle
>   1763 | cmc.name | identifier     | fr-CA       | Identifiant
>   1762 | cmc.name | series         | fr-CA       | Collection
>   1760 | cmc.name | author         | fr-CA       | Auteur
>
>   1761 | cmc.name | subject        | fr-CA       | Sujet
> (6 rows)
>
> In our case, we can update a field with a translation we don't like as follows:
>
> UPDATE config.i18n_core SET string = 'Mot-clé' WHERE id = 1758;
>
> Or add a field that currently has no translation (title is missing, in
> our case):
>
> INSERT INTO config.i18n_core (fq_field, identity_value, translation,
> string) VALUES ('cmc.name', 'title', 'fr-CA', 'Titre');
>
> So - those are the broad classes. The narrower ones are what you were
> asking about specifically; those are defined in config.metabib_field,
> with a class ID of "cmf" and a primary field of "id" this time:
>
> SELECT * FROM config.i18n_core WHERE translation = 'fr-CA' AND
> fq_field LIKE 'cmf.%';
>    id  | fq_field  | identity_value | translation |
> string
> ------+-----------+----------------+-------------+------------------------------------
>   1825 | cmf.label | 27             | fr-CA       | ID interne
>   1826 | cmf.label | 1              | fr-CA       | Titre du périodique
>   1827 | cmf.label | 21             | fr-CA       | ISMN
>   1828 | cmf.label | 2              | fr-CA       | Abréviation du titre
>
> The same process that we used for config.metabib_class values applies
> for updates and inserts, adjusting for the different fq_field
> identifier:
>
> INSERT INTO  config.i18n_core (fq_field, identity_value, translation,
> string) VALUES ('cmf.label', '8', 'fr-CA', 'Auteur personnel');
>
> Repeat for all of your translated terms, run "autogen.sh", and you
> should be good to go (well -- assuming that your browser doesn't cache
> the previous versions of JavaScript that it has downloaded).
>
>> And actually one more question - is it possible to influence the order in
>> which individual facets appear?
> I'm going to sidestep this question :) Anyone else want to step up to that one?
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: facets.png
Type: image/png
Size: 168062 bytes
Desc: not available
URL: <http://libmail.georgialibraries.org/pipermail/open-ils-general/attachments/20111204/8b67a3a5/attachment-0001.png>


More information about the Open-ils-general mailing list