Bug 7939: Separate po files for different MARC dialects
authorBernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Sun, 23 Mar 2014 22:01:43 +0000 (19:01 -0300)
committerTomas Cohen Arazi <tomascohen@gmail.com>
Thu, 30 Apr 2015 14:22:03 +0000 (11:22 -0300)
commit47c321ea33bf2ccad9dcf88cfcdeae6be83e9024
tree459cbf03d6d5277155f15d0396b09d648fd06348
parente38b21fa39773c3aceec3b98f698c4488d08f758
Bug 7939: Separate po files for different MARC dialects

This patch implements separate PO files for
different MARC dialects.

It depends on correct filenames, i.e. it will build PO
files using files with/without "unimarc|normarc|marc21"
on their names.

Changes:
A) LangInstaller.pm
Added definitions to create or update xx-YY-{MARCFLAVOR}.po,
minor change to create and install procedure, and modification
of install procedure to handle multiple target dirs.
Updated documentation.

B) Standarization of filenames
STAFF po file is now xx-YY-staff-prog.po
MARC dialects po files are xx-YY-marc-{MARCFLAVOUR}.po

To test:
1) Update po files for your preferred language, ej. nn-NO
cd misc/translator
perl translate update nn-NO

2) Do some copying/renaming
cp po/nn-NO-i-staff-t-prog-v-3006000.po po/nn-NO-marc-UNIMARC.po
cp po/nn-NO-i-staff-t-prog-v-3006000.po po/nn-NO-marc-NORMARC.po
cp po/nn-NO-i-staff-t-prog-v-3006000.po po/nn-NO-marc-MARC21.po
mv po/nn-NO-i-staff-t-prog-v-3006000.po po/nn-NO-staff-prog.po

(most MARC dialect strings are on staff, so we use that as basis)

3) Apply the patch

4) Update again to fix translation files, verbose
perl translate update nn-NO -v

5) Install language, verbose, verify translations
perl translate install nn-NO -v

6) Create translation files
rm po/nn-NO*
perl translate create nn-NO

we must have this list:
po/nn-NO-marc-MARC21.po
po/nn-NO-marc-NORMARC.po
po/nn-NO-marc-UNIMARC.po
po/nn-NO-opac-bootstrap.po
po/nn-NO-pref.po
po/nn-NO-staff-help.po
po/nn-NO-staff-prog.po

Additional tests:
7) Number of msgids
7.a) Before patch and after upgrade, extract and count msgids
for i in $(ls po/nn-NO-*po); \
do msginit -i $i -o nn-old.po --no-translator --no-wrap --locale=nn_NO; \
egrep ^msgid nn-old.po >> old; \
done
sort old | uniq | tee s-old | wc -l > n-old
s-old: have all msgids
n-old: number of msgids

7.b) After patch and after creation of new files
Repeat procedure, diferent files (s-new, n-new)

7.c) Compare (diff s-old snew), they are the same
(save for a strange UNIMARC char in my case, but
it's present on corresponding PO file)

8) Installed dirs/files
8.a) List of EN dirs/files
cd koha-tmpl
find | egrep "/en/" > en

8.b) List of nn-NO dirs/files. After patch and language install
cd koha-tmpl
find | egrep "/nn-NO/" | sed 's|/nn-NO/|/en/|' > nn

8.c) Compare (diff en nn), they are the same

Signed-off-by: Magnus Enger <magnus@enger.priv.no>
Followed the steps outlined by Bernardo, and everything works as
expected. I think the most important points are that "perl translate
create nn-NO" produces the right files, and translating anything in
them, then doing "translate install" makes the translations show
up in the interface. The numbers msgids in the nn-NO correspond
well wit the number of msgids in other sets of .po files.

I bet y'all will be happy when you don't have to see the stupid
Norwegian strings when you translate! ;-)

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
misc/translator/LangInstaller.pm