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

2012-01-05 Thread Dan Scott
> On Thu, Jan 5, 2012 at 11:24 AM, Mike Rylander  wrote:
>> On Thu, Jan 5, 2012 at 1:09 AM, Dan Scott  wrote:
>> With any luck, someone will merge those changes into master, as well as
>> backport the updated translations into rel_2_1 so that the new
>> translations will be available in Evergreen 2.1.2.
>
> I caught a leprechaun, stole its luck, and merged both branches.

Thanks Mike! (I have a vision of a strange leprechaun/tree hybrid...)


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

2012-01-05 Thread Mike Rylander
On Thu, Jan 5, 2012 at 1:09 AM, Dan Scott  wrote:
> On Mon, Dec 05, 2011 at 07:33:37PM +0100, Linda Jansova wrote:
>> Hi Dan,
>>
>> Thanks a lot for your explanation! We are well aware of the fact
>> that the strings don't really travel from one place to the other on
>> their own - on the other hand, we do appreciate the possibility to
>> use Launchpad for translations (it used to be far more difficult to
>> cooperate on translations with downloaded files). Anyway, we look
>> forward to the next version with our Czech strings included :-)!
>
> Well, with bug https://bugs.launchpad.net/evergreen/+bug/912136 I've
> pointed at a branch that both contains the updated translations (for all
> locales) as well as automates one piece of the puzzle: copying the
> updated translations from the Launchpad translation export bzr branch
> into the appropriate Evergreen locations. It also contains some general
> cleanup.
>
> With any luck, someone will merge those changes into master, as well as
> backport the updated translations into rel_2_1 so that the new
> translations will be available in Evergreen 2.1.2.

I caught a leprechaun, stole its luck, and merged both branches.

-- 
Mike Rylander
 | Director of Research and Development
 | Equinox Software, Inc. / Your Library's Guide to Open Source
 | phone:  1-877-OPEN-ILS (673-6457)
 | email:  mi...@esilibrary.com
 | web:  http://www.esilibrary.com


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

2012-01-04 Thread Dan Scott
On Mon, Dec 05, 2011 at 07:33:37PM +0100, Linda Jansova wrote:
> Hi Dan,
> 
> Thanks a lot for your explanation! We are well aware of the fact
> that the strings don't really travel from one place to the other on
> their own - on the other hand, we do appreciate the possibility to
> use Launchpad for translations (it used to be far more difficult to
> cooperate on translations with downloaded files). Anyway, we look
> forward to the next version with our Czech strings included :-)!

Well, with bug https://bugs.launchpad.net/evergreen/+bug/912136 I've
pointed at a branch that both contains the updated translations (for all
locales) as well as automates one piece of the puzzle: copying the
updated translations from the Launchpad translation export bzr branch
into the appropriate Evergreen locations. It also contains some general
cleanup.

With any luck, someone will merge those changes into master, as well as
backport the updated translations into rel_2_1 so that the new
translations will be available in Evergreen 2.1.2.


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

2011-12-06 Thread Mike Rylander
2011/12/4 Linda Jansova :
> 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?
>

Dan answered this one (also, IIRC, master and the upcoming 2.2 allow
translation of these from within the staff client).

> And actually one more question - is it possible to influence the order in
> which individual facets appear? In our installation we currently see the
> following order of author facets:
> Corporate Author
> Other Author
> Personal Author
>
> They seem to be ordered alphabetically. However, from a user point of view,
> it would probably be better to promote the Personal Author to the very
> beginning of the list. Is it possible to achieve this somehow (and if so,
> how exactly :-)?
>

If you take a look at the top of the openils.widget.FacetSidebar dojo
module* you'll see an example of how do do what you want.  Basically,
you add a classOrder attribute to the div that has a dojoType of
openils.widget.FacetSidebar in
web/opac/skin/default/xml/common/sidebar.xml (adjusted for your skin's
name, of course).  For instance, to push Personal Author to the top,
you might add the following classOrder:

  
classOrder='[{name:"author","facetOrder":["personal","corporate","conference","other"]},"subject","series"]'


(*) 
http://git.evergreen-ils.org/?p=Evergreen.git;a=blob;f=Open-ILS/web/js/dojo/openils/widget/FacetSidebar.js;h=25c2175d836fc8d5215dc48275fed8302b63aa81;hb=master

-- 
Mike Rylander
 | Director of Research and Development
 | Equinox Software, Inc. / Your Library's Guide to Open Source
 | phone:  1-877-OPEN-ILS (673-6457)
 | email:  mi...@esilibrary.com
 | web:  http://www.esilibrary.com


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

2011-12-05 Thread Linda Jansova

Hi Dan,

Thanks a lot for your explanation! We are well aware of the fact that 
the strings don't really travel from one place to the other on their own 
- on the other hand, we do appreciate the possibility to use Launchpad 
for translations (it used to be far more difficult to cooperate on 
translations with downloaded files). Anyway, we look forward to the next 
version with our Czech strings included :-)!


Linda and Vaclav

Dne 5.12.2011 00:08, Dan Scott napsal(a):

Hi Linda:

On Sun, Dec 4, 2011 at 2:32 PM, Linda Jansova  wrote:

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?

Yes, that string comes from the Searcher.js set of strings at
Open-ILS/web/js/dojo/openils/widget/nls/cs-cz/Searcher.js - but
similar to the database strings, ultimately they're fed into the
process from http://translations.launchpad.net/evergreen - which
appears to have had fully translated strings since August 2011. Hmm.



Unfortunately, it looks like the translated strings haven't been
updated in our source repo - there's
nobuild/i18n/po/Searcher.js/cs-CZ.po file, so all that's in 2.1.1 is a
copy of the English strings. This is my fault, as I updated the
strings in September 2011 but appear to have missed bringing over
brand new files that were added :(

If you haven't guessed, the process of pulling updated strings from
Launchpad and pushing them into our git repo, and the reverse process
of updating new and changed strings in Launchpad, has not been
automated. The whole git / bzr divide is a bit of a pain to cross, and
Launchpad uses different locale codes that Evergreen does, so getting
it automated would be awesome.

Dan



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

2011-12-04 Thread Dan Scott
Hi Linda:

On Sun, Dec 4, 2011 at 2:32 PM, Linda Jansova  wrote:
> 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?

Yes, that string comes from the Searcher.js set of strings at
Open-ILS/web/js/dojo/openils/widget/nls/cs-cz/Searcher.js - but
similar to the database strings, ultimately they're fed into the
process from http://translations.launchpad.net/evergreen - which
appears to have had fully translated strings since August 2011. Hmm.



Unfortunately, it looks like the translated strings haven't been
updated in our source repo - there's
nobuild/i18n/po/Searcher.js/cs-CZ.po file, so all that's in 2.1.1 is a
copy of the English strings. This is my fault, as I updated the
strings in September 2011 but appear to have missed bringing over
brand new files that were added :(

If you haven't guessed, the process of pulling updated strings from
Launchpad and pushing them into our git repo, and the reverse process
of updating new and changed strings in Launchpad, has not been
automated. The whole git / bzr divide is a bit of a pain to cross, and
Launchpad uses different locale codes that Evergreen does, so getting
it automated would be awesome.

Dan


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

2011-12-04 Thread Dan Scott
Hi Linda:

2011/12/4 Linda Jansova :
> 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?