Commit graph

562 commits

Author SHA1 Message Date
Bernardo Gonzalez Kriegel
e365e6e535 Bug 14285: Bengali locale needs to be re-defined
This patch renames translation files for Bengali
language, from ben-* to bn-IN-*.
Also adds India as region

To test:
1) Apply the patch
2) Run updatedatabase
3) Install Bengali language
cd misc/translator
perl translate install bn-IN
enable

Check correct description

4) Create and install a fake Bengali variant
cd misc/translator
perl translate create bn-XX
perl translate install bn-XX
enable both variants

Check correct rendering of region

Results comply with expected test plan outcome. Signed off for bn-IN
Signed-off-by: Indranil Das Gupta (L2C2 Technologies) <indradg@gmail.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-06-01 15:22:27 -03:00
Bernardo Gonzalez Kriegel
446faf793f Translation updates for Koha 3.20.0 release
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2015-05-22 12:34:08 -03:00
Bernardo Gonzalez Kriegel
eb1ccb313a Translation updates for Koha 3.20 beta
New languages: Esperanto (eo) and Georgian (ka)

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-05-12 10:14:20 -03:00
Bernardo Gonzalez Kriegel
5caa05104d Bug 12192: Template toolkit code in HTML attributes is picked up into po-files
This patch gives a partial solution for this problem.
It ignores strings like "[% something %]", but not
"[% IF ( value )  %][% value %][% END %]"

We get 100+ strings less to translate

To test:
1) Update translation files for your preferred language
2) Apply the patch
3) Update again
4) Compare, you must find 100+ strings removed from
translation files

eg.
-msgid "[% SEARCH_RESULT.biblionumber |url %]"
-msgid "[% accepteddate | $KohaDates %]"
-msgid "[% amountoutstanding | format('%.2f') %]"
-msgid "[% authtypetext |html %]"
-msgid "[% barcode_llx |html %]"
-msgid "[% barcode_lly |html %]"
-msgid "[% biblio.quantity.length ? biblio.quantity : 1 %]"
-msgid "[% billingdate | $KohaDates %]"
-msgid "[% borname |html %]"
...

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Verified all strings removed from the po files were
pure TT.
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-05-06 10:40:14 -03:00
Bernardo Gonzalez Kriegel
6974481f2b Bug 7939: (followup) Update translation files
Create/rename/update/fix translation files

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-04-30 11:27:57 -03:00
Bernardo Gonzalez Kriegel
47c321ea33 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>
2015-04-30 11:22:03 -03:00
Jonathan Druart
a6c9bd0eb5 Bug 9978: Replace license header with the correct license (GPLv3+)
Signed-off-by: Chris Nighswonger <cnighswonger@foundations.edu>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>

http://bugs.koha-community.org/show_bug.cgi?id=9987

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-04-20 09:59:38 -03:00
Bernardo Gonzalez Kriegel
1c8c8885f1 Fix printf errors on master PO files
This patch set as fuzzy some strings on translation files
that are incorrectly translated

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Makes translations work.
2015-03-30 12:51:57 -03:00
mxbeaulieu
c9a52f739c Bug 13794: Text input field values not translated
I left the code logic intact, and simply removed "text" from the regex.
Text input field values are now translated, no other logical changes are introduced.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>

Test:
1) Update, install and enable es-ES language
2) Go to Reports > Acquisition wizard
3) On page bottom, there is a text field with the word 'Export'
4) Switch language, the word is not translated
5) Apply the patch
6) Update and install again es-ES language
7) Reload page, text now reads 'Exportar'

No koha-qa errors.

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-03-15 09:22:05 -03:00
Bernardo Gonzalez Kriegel
0edebb12b4 Bug 13362: translate script creates dirs on update
A dir creation was uncommented (by me), the effect is
create a lang dir on 'update', which is no needed.

To test:
1) Update translation files for a uninstalled language
(cd misc/translator; ./translate update xx-YY)

2) Check new dirs
koha-tmpl/opac-tmpl/bootstrap/xx-YY/
koha-tmpl/intranet-tmpl/prog/xx-YY/
koha-tmpl/intranet-tmpl/prog/en/modules/help/xx-YY/

3) Clean all
git clean -f -d

4) Apply the patch

5) Repeat 1) (i.e. update)

6) Check no new dirs this time

Signed-off-by: Frederic Demians <f.demians@tamil.fr>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Tested according to test plan, works as described.
Passes tests and QA script.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-12-17 19:29:28 -03:00
Bernardo Gonzalez Kriegel
d9b50a47b4 Translation updates for Koha 3.18.0 release 2014-11-28 13:01:28 -03:00
Bernardo Gonzalez Kriegel
2cb427008d Fix errors on Korean translation files
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Translation manager pull request so the po get updated correctly
for translation.
2014-11-27 14:20:46 -03:00
Bernardo Gonzalez Kriegel
d1e05b67d1 Bug 13328: Rename Kurdish translation files
Kurdish translation files use a variant of Arabic script,
they need to be displayed as RTL.

Currently that is inferred from language dir name after
translation, and that name use the language tag, so we
need to change it from 'ku' to 'ku-Arab'

To test:
1) Translate to Kurdish
(cd misc translator; ./translate install ku)
2) Enable Kurdish on opac/staff
3) Test staff/opac interface, they are displayed as LTR
which is wrong
4) Disable Kurdish language
5) Do a cleanup (git clean -f -d)

5) Apply the patch

6) Translate again
(cd misc translator; ./translate install ku-Arab)
7) Enable again
8) Test again, this time display is correct (LTR)

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Easy to test. Well spotted Bernardo.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Works as described.
2014-11-23 10:05:41 -03:00
Bernardo Gonzalez Kriegel
d37d8c7f00 Translation updates for Koha 3.18.0-beta release
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-17 11:01:50 -03:00
Katrin Fischer
2669c51be4 Bug 10136: Remove outdated translation tool docs
Patch removes outdated translation tool documentation
from the misc/translator directory.

Signed-off-by: Magnus Enger <digitalutvikling@gmail.com>
Removing these lines sounds like a good idea. I tested by
applying the patch and checking that the files in question
are gone.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-14 11:41:45 -03:00
Bernardo Gonzalez Kriegel
0258d3a42d Bug 12535 - PROG/CCSR Deprecation: Make opac translation theme independent
This patch makes opac translation files theme independent
A side effect is that current prog translation file is
renamed.

But the renaming is not added, that gives a patch of ~60M!

Current list of languages are now obtained from pref files.

To test:
1) Apply the patch

2) For your preferred language, rename opac prog file
from 'xx-YY-i-opac-t-prog-v-3006000.po' to 'xx-YY-opac-prog.po'

3) Update that language, there must be no errors
cd misc/translation
./translate update xx-YY [-v]
Check updated po files

4) Install any language, there must be no errors
./translate install xx-YY
Check prog theme for that language

5) Create translation files. Remove a language or create new lang files
./translate create zz-WW
ls -l po/zz-WW*po
check there are 3 files (and *~) for opac

6) Check updated pod for LangInstaler.pm and translate script

When PROG/CCSR themes are removed, I'll add a Bug to remove
corresponding files.

Perhaps RM could add a followup to rename all files,
cd misc/translator/po
for old in $(ls *opac-t*); do
    new=$(echo $old | sed 's/-i-opac-t-prog-v-3006000/-opac-prog/');
    git mv $old $new;
done

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Works as described, no problems found.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-10-29 22:00:22 -03:00
Bernardo Gonzalez Kriegel
0bcffb973e Bug 12999: Untranslatable string on enhanced_content.pref
This patch modifies LangInstaller.pm to catch strings
on syspref files that have no associated syspref

To test:
1) Update strings for your preffered language
2) Check that the string "you can only choose one source"
is not present on xx-YY-pref.po file

3) Apply the patch
4) Update strings again
5) Check the strig now appears [ and another one :) ]

Doing a diff before and after will show
 # Enhanced Content > All
 msgid "enhanced_content.pref## <strong>NOTE:</strong> you can only
 choose one source of cover images from below, otherwise Koha will show
 the images from all sources selected."
 msgstr ""

 # Local Use
 msgid "local_use.pref## Nothing defined yet."
 msgstr ""

6) Translate the string
7) Install your language, check Administration > System preferences >
   Enhanced content > All
   (on your languge) and check the string is now translated

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-10-14 11:06:28 -03:00
Bernardo Gonzalez Kriegel
9e3dd1f2b7 Fix of translation files as requested by RM
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-10-11 16:55:40 -03:00
Bernardo Gonzalez Kriegel
7a325b55d1 Bug 12061 - tmpl_process3.pl - Include/exclude file by name
This patch adds options to include/exclude files by matching their names.
Also modifies current code to check only filenames (not dirs)
Checking is case insensitive !!

NOTE: The difference between -f and -m is subtle, but important.
They differs mainly on update,: -f do a merge, -m a replace

To test after patch:

A) Include only 'normarc'
1. create
cd misc/translator
perl tmpl_process3.pl create -i ../../koha-tmpl/opac-tmpl/bootstrap/en -s normarc.po -r -m normarc
- check provenance of strings
egrep "^#:" normarc.po | cut -d":" -f2 | sort | uniq
- only files with normarc in their names must be present

2. update
perl tmpl_process3.pl update -i ../../koha-tmpl/opac-tmpl/bootstrap/en -s normarc.po -r -m normarc
- repeat check

3. install
mkdir test
perl tmpl_process3.pl install -i ../../koha-tmpl/opac-tmpl/bootstrap/en -o ./test -s normarc.po -r -m normarc
- check name of created files

rm -rf test normarc.po

B) Exclude
4. create
perl tmpl_process3.pl create -i ../../koha-tmpl/opac-tmpl/bootstrap/en -s xnormarc.po -r -n normarc
- check provenance
egrep "^#:" xnormarc.po | cut -d":" -f2 | sort | uniq | grep -i normarc
- there must be no results

5. update
perl tmpl_process3.pl update -i ../../koha-tmpl/opac-tmpl/bootstrap/en -s xnormarc.po -r -n normarc
- check provenance

6. install
mkdir test
perl tmpl_process3.pl install -i ../../koha-tmpl/opac-tmpl/bootstrap/en -o ./test -s xnormarc.po -r -n normarc
- check files
find test | grep -i normarc
- there must be no results

You can also try another combination, use for example "-m patron -m user -m bottom" (or use -n)
or mixed "-m marc -n normarc", do create/install and look filenames

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-09-01 11:00:15 -03:00
Bernardo Gonzalez Kriegel
b96a209ff7 Bug 12061 - tmpl_process3.pl - Multiple source dir
This patch adds the option to use multiple source
dirs for tmpl_process3.pl on create/update actions.

To test after patch:
A) Old
1. install
cd misc/translator
perl tmpl_process3.pl create -i ../../koha-tmpl/opac-tmpl/bootstrap/en -s bootstrap.po -r

2. update
perl tmpl_process3.pl update -i ../../koha-tmpl/opac-tmpl/bootstrap -s bootstrap.po -r

3. install
mkdir test
perl tmpl_process3.pl install -i ../../koha-tmpl/opac-tmpl/bootstrap -s bootstrap.po -r -o ./test -q
- check same number of files
ls -lR ../../koha-tmpl/opac-tmpl/bootstrap | wc -l
ls -lR ./test | wc -l

rm -f bootstrap.po

B) New
4. create from multiple sources
perl tmpl_process3.pl create -i ../../koha-tmpl/opac-tmpl/prog/en -i ../../koha-tmpl/opac-tmpl/bootstrap/en -i ../../koha-tmpl/opac-tmpl/ccsr/en -s opac.po -r

5. update from multiple source
perl tmpl_process3.pl update -i ../../koha-tmpl/opac-tmpl/prog/en -i ../../koha-tmpl/opac-tmpl/bootstrap/en -i ../../koha-tmpl/opac-tmpl/ccsr/en -s opac.po -r

6. install (must give an error)
perl tmpl_process3.pl install -i ../../koha-tmpl/opac-tmpl/prog/en -i ../../koha-tmpl/opac-tmpl/bootstrap -s opac.po -r -o ./test

7. updated help
perl tmpl_process3.pl --help

Any other functionality must not be affected

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-09-01 11:00:08 -03:00
Bernardo Gonzalez Kriegel
16636c34d2 Bug 12061 - tmpl_process3.pl - Remove obsoleted strings/backups
This patch modifies the update process for PO files,
removing obsoleted strings. Currently they are removed
manually as part of the standar procedure of strings update.
Also backup files (*~) need to be removed manually.

To test:
1. Update translation files for any language, ej. fi-FI
(cd misc/translation; perl translate update fi-FI)

2. Check existence of obsoleted strings
egrep "#~ msg" misc/translator/po/fi-FI-*

3. Check existence of backup files
ls misc/translator/po/fi-FI-*~

4. Reset to HEAD and clean

5. Apply the patch

6. Update again, check there are no more obsoleted
strings nor backup files

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-09-01 11:00:03 -03:00
afd2418d73 Bug 11349: Change .tmpl -> .tt in scripts using templates
Since we switched to Template Toolkit we don't need to stick with the
sufix we used for HTML::Template::Pro.

This patch changes the occurences of '.tmpl' in favour of '.tt'.

To test:
- Apply the patch
- Install koha, and verify that every page can be accesed

Regards
To+

P.S. a followup will remove the glue code.

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-07-17 11:05:49 -03:00
Jonathan Druart
35a88a5c44 Bug 12301: Remove warnings on translate scripts
Using perl v5.18, the following is warned on updating/installing
templates:
  Smartmatch is experimental at ./translate line 54.

Moreover, the following should exist with previous perl versions:

perlcritic xgettext
Subroutine prototypes used at line 29, column 1.  See page 194 of PBP.
(Severity: 5)
Subroutine prototypes used at line 44, column 1.  See page 194 of PBP.
(Severity: 5)
Subroutine prototypes used at line 60, column 1.  See page 194 of PBP.
(Severity: 5)
Subroutine prototypes used at line 72, column 1.  See page 194 of PBP.
(Severity: 5)
Subroutine prototypes used at line 89, column 1.  See page 194 of PBP.
(Severity: 5)
Variable declared in conditional statement at line 105, column 13.
Declare variables outside of the condition.  (Severity: 5)
Subroutine prototypes used at line 127, column 1.  See page 194 of PBP.
(Severity: 5)
Subroutine prototypes used at line 136, column 1.  See page 194 of PBP.
(Severity: 5)
Variable declared in conditional statement at line 190, column 7.
Declare variables outside of the condition.  (Severity: 5)
Subroutine prototypes used at line 237, column 1.  See page 194 of PBP.
(Severity: 5)
Bareword file handle opened at line 238, column 5.  See pages 202,204 of
PBP.  (Severity: 5)
Two-argument "open" used at line 238, column 5.  See page 207 of PBP.
(Severity: 5)
Subroutine prototypes used at line 277, column 1.  See page 194 of PBP.
(Severity: 5)
Subroutine prototypes used at line 311, column 1.  See page 194 of PBP.
(Severity: 5)
Bareword file handle opened at line 350, column 9.  See pages 202,204 of
PBP.  (Severity: 5)
Two-argument "open" used at line 350, column 9.  See page 207 of PBP.
(Severity: 5)
Bareword file handle opened at line 353, column 5.  See pages 202,204 of
PBP.  (Severity: 5)
Bareword file handle opened at line 359, column 5.  See pages 202,204 of
PBP.  (Severity: 5)
Two-argument "open" used at line 359, column 5.  See page 207 of PBP.
(Severity: 5)

perl -wc xgettext.pl
\1 better written as $1 at TmplTokenizer.pm line 474.
main::token_negligible_p() called too early to check prototype at
xgettext.pl line 52.
xgettext.pl syntax OK

Test plan:
Apply this patch and verify the warnings/errors does not appear anymore
and no regression is found on creating/updating/installing templates.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Work as described, no koha-qa errros.
Tested with perl v5.18.2
No warnings, no problem detected on create/update/install i18n files

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-05-30 15:46:17 -03:00
Bernardo Gonzalez Kriegel
6b928438ce Translation updates for 3.16.00 final release
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-05-22 14:35:05 +00:00
Bernardo Gonzalez Kriegel
ceb017765f Translation update for 3.16.00 release
New languages:

Belarusian be-BY
Faroese fo-FO
Rwandan rw-RW
Swahili sw-KE

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-05-19 18:53:06 +00:00
Julian Maurice
d24b24adee Bug 11848: Make Koha::I18N easier to use
Instead of writing

  use CGI;
  use Koha::I18N;
  my $cgi = new CGI;
  my $lh = Koha::I18N->get_handle_from_context($cgi, 'intranet');
  print $lh->maketext('my translatable text');

you can now write

  use Koha::I18N;
  print gettext('my translatable text');

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-05-05 04:30:02 +00:00
Julian Maurice
75bd34df7a Bug 8044: (follow-up) fix warning and error messages in translate.pl
CHARSET is now automatically replaced by UTF-8, and 'update' creates the
PO file if it does not exist.

Also do not try to create PO files if POT file creation failed (when
there is no messages to translate for example).

+ add some verbosity
+ add Locale::Maketext and Locale::Maketext::Lexicon to Koha
dependencies

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-05-05 04:26:00 +00:00
Julian Maurice
114f3dd499 Bug 8044: new module for translating strings in Perl source files
You have to use the new module Koha::I18N

Code example:
  use Koha::I18N;
  use CGI;

  my $input = new CGI;
  my $lh = Koha::I18N->get_handle_from_context($input, 'intranet');

  print $lh->maketext("Localized string!");

PO files are in misc/translator/po/LANG-messages.po.
Creation of PO files are integrated to existing workflow, so to create
PO file for a language, just run in misc/translator:
  ./translate create LANG
To update:
  ./translate update LANG
You can then translate the PO with your favorite editor. Strings will be
localized at runtime.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Works as advertised. Some details needing further attention noted on bug
report.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-05-05 04:24:53 +00:00
Pasi Kallinen
c229553040 Bug 11631: Make i18n toolchain ignore useless strings
This patch removes several types of strings from the
PO files that cannot be usefully translated, including
ones that consist entirely of punctuation and/or HTML entities.

Test:
1) Update PO files of some lang, xx-YY-*po
cd misc/translator
perl translate update xx-YY
2) Do it again, just in case
3) rm po/xx-YY*po~
4) Extract all msgid's, sorted
cat po/xx-YY*po | egrep "^msgid" | sort | uniq > xx-YY-pre
5) Apply the patch
6) Repeat 1-3
7) Repeat 4 again, other file
cat po/xx-YY*po | egrep "^msgid" | sort | uniq > xx-YY-post
8) Do a diff, inspect results, only strings with %s and \s
diff xx-YY-pre xx-YY-post | less

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Works as described, 380 strings less to 'translate'
No koha-qa errors.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Tested according to test plan, works as described.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-27 21:06:48 +00:00
Jonathan Druart
bece83f8ed Bug 9216: make columns.def file translatable
The SQL column headers is stored into the columns.def file.
This file is not managed by the translation script.

This patch makes possible the headers translation.
Note: The translation xml tags were added to avoid all lines being put
on a single line.

Test plan:
1/ update your po file
cd misc/translate;
perl translate -f columns update LANG # Replace by another language here
2/ translate header columns (search "columns.def" in your po file).
3/ install the translated columns.def
perl translate -f columns install LANG # Replace by another language here
4/ go on the report module > create a new report > next > next
5/ change the language
on the 3rd step, you should see the column header translated.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Work as described, no koha-qa errors

[on es-ES about a third of the strings translated!! :-) ]

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Works as described and fixes a long standing translation
problem.
Passes all tests and QA script.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-19 13:34:33 +00:00
Bernardo Gonzalez Kriegel
de81d7abe4 Bug 12081: make tmpl_process3.pl delete ts temp files
This patch enable deletion of temp files used by
tmpl_process3.pl.
Just removed coments on existing code

To test:
1. Do a count of files on /tmp ( ls /tmp | wc -l )
2. Update preferred language
3. Count again, new files on /tmp
4. Apply the patch
5. Update again, check, no new files

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>

NOTE: I watched what temp files were actually in /tmp to make
      sure other processes didn't magically increase/decrease
      the number.
          $ perl translate update {lang code}
      generated 10 temporary files for me (2x5 po files). After
      removing those ten files, and applying the patch, no
      other files were generated.

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
These lines has been commented by commit
a399dcefad without any apparent good
reason.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-16 15:32:52 +00:00
Bernardo Gonzalez Kriegel
fe205c907a Bug 11393: fix display of Thai in language menu when Thai translation is installed
The problem is with the name of PO files

Currently Koha expect, among other variants, that PO filenames
began with (using as example *-pref.po):
{lang}-pref.po
{lang}-{region}-pref.po
{lang}-{script}-pref.po
{lang}-{script}-{region}-pref.po
and expect 2 chars for lang and region, and 4 for script

So the problem with Thai translation files are that it's names
do not match that convention.

This patch only rename Thai files as th-THA-* to th-TH-*.
In that way language description is right.
translate script use that chars to make dirs, and use dirs to find
description.

To test:
1) Go to I18N/L10N sysprefs
2) Install th-THA language (or simply mkdir koha-tmpl/intranet-tmpl/prog/th-THA)
3) Reload page, wrong description
4) Apply patch
5) Install th-TH language (or simply mkdir koha-tmpl/intranet-tmpl/prog/th-TH)
6) Reload page, right description
7) If you want do "mkdir koha-tmpl/intranet-tmpl/prog/th-Thai", reload,
   also right description

To the reporter of this Bug: the rename of the folder is a good
workaround, when this patch is pushed to stable I'll rename Thai
files

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>

This does not correct existing problems which need human
intervention. It does, however, allow for a correct installation
of Thai after the patch is made.

If we really want a patch for fixing an existing install. I
wrote it, but have not tested it.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
As pointed out by Mark, this does not fix existing installations.
Putting a note in the release notes might be something we can do here.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-03 15:38:10 +00:00
Jonathan Druart
bab96c3f22 Bug 11571: fix breakage of -f option for translate script
Bug 7934 breaks the -f option introduced in bug 9161; this patch
repairs the regression.

While the generation of the command tmpl_process3.pl, a space is
missing if the -x option is given.

The tmpl_process3.pl is called like:
/home/koha/src/misc/translator/tmpl_process3.pl -q update -i
/home/koha/src/koha-tmpl/intranet-tmpl/prog/en/ -s
/home/koha/src/misc/translator/po/fr-FR-i-staff-t-prog-v-3006000.po -r
-x 'help'-f pay.tt

Revised test plan:
1) cd ./misc/translator
2) put a warn at LangInstaller.pm line 375.
3) time ./translate update fr-FR -f pay.tt
-- note the execution time and the output. The options in the
    command contain "-x 'help'-f pay.tt"
    The -f param is not passed to the script.
    The execution time is strangely long.
5) git reset --hard origin/master
6) apply this patch
7) put a warn at LangInstaller.pm line 375.
8) time ./translate update fr-FR -f pay.tt
-- verify the output and the execution time is now corrected.

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes all tests and QA script.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-01-26 15:50:41 +00:00
Bernardo Gonzalez Kriegel
466a7320d1 Translation update - split staff UI and help files 2013-12-17 16:22:49 -03:00
Bernardo Gonzalez Kriegel
6cf065da5e Bug 7934: generate separate PO files for help pages
This patch modifies LangInstaller.pm to enable separation
of translation for Staff UI and Staff Help files.

It's a move that make sense, Help strings accounts for
44% of total word count for Staff, and as stated on
Comment #1, it could enable a different workflow on
translation work.

It's more a hack than an elegant solution, but it works.
Feel free to suggest another approach.

To test:

We need to test complete functionality, i.e. create and update
translation files and install translation, and verify that no
string is missing.

1) Before applying the patch, we need some data from staff file.
Pick your language, say de_DE, and

cd misc/translator/
perl translate update de-DE
msginit -i po/de-DE-i-staff-t-prog-v-3006000.po -o de-old.po --no-translator --no-wrap --locale=de_DE
egrep ^msgid de-old.po | sort | tee s-old | wc -l > number-old

We have the file s-old with all strings, and the number of strings on number-old

2) Apply the patch

3) New help file is called de-DE-staff-help.po, so create one
cp'ing old staff on new help

cp po/de-DE-i-staff-t-prog-v-3006000.po po/de-DE-staff-help.po

4) Make a new update, and analize

perl translate update de-DE
msginit -i po/de-DE-i-staff-t-prog-v-3006000.po -o de-new.po --no-translator --no-wrap --locale=de_DE
msginit -i po/de-DE-staff-help.po -o de-help.po --no-translator --no-wrap --locale=de_DE
egrep ^msgid de-new.po | sort | tee s-new | wc -l > number-new
egrep ^msgid de-help.po | sort | tee s-help | wc -l > number-help
cat s-new s-help | sort | uniq | tee s-all | wc -l > number-all
cat s-new s-help | sort | uniq -d | tee s-dup | wc -l > number-dup

Ideally what we need to found is:

diff s-old s-all = zero lines (old strings vs new strings)

In my test I got one line, but it's a false positive (the string "• " is present on new staff)

On numbers,

number-old - number-new - nummber-help + number-dup = 0
or
number-old - number-all = 0

(in my test again I have 1 as result, same string. Also there are 137
repeated lines between new staff and help)

All this tells me that all string to translate are preserved

5) Install translation

perl translate install de-DE

Enable language on staff, and check that help files are translated

6) Finally, create translation files

rm po/de-DE-*
perl translate create de-DE

verify that all files are created. Tests of 4) can be repeated.

7) Verify that no strings from help are present on staff UI file

egrep help po/de-DE-i-staff-t-prog-v-3006000.po

Only results came from help-top and bottom, and a few "help" on staff strings

Signed-off-by: Fridolyn SOMERS <fridolyn.somers@biblibre.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Tested according to test plan. Checked various pages in OPAC,
staff and intranet, translation was ok.
Passes QA script and tests.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-12-17 05:42:20 +00:00
Bernardo Gonzalez Kriegel
83a5756645 Translation updates for 3.14.0
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-11-20 18:33:32 +00:00
Bernardo Gonzalez Kriegel
616db836b9 Translation files for 3.14.0-beta
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-10-29 14:24:34 +00:00
Jonathan Druart
37234811a5 Bug 9161: Followup: the -f param does not work correctly
Without this patch, the -f param (for the translate script) add the
modified line in the po file BUT comment all lines from others files.

This patch concat the generated file with the previous one and merge
them. This way produce a pretty po file with all our strings :)

+ Modification in LangInstaller.pm to fix a bug when the -f param was not
given.

Test plan:
1/ Update your po file :
cd misc/translator
perl translate update fr-FR
git commit -a -m"TMP PO"
2/ Modification on 2 files:
ie.
catalogue/advsearch.tt:32 <h1>Advanced search Foo</h1>
catalogue/issuehistory.tt:38 <th>Patron Bar</th>

3/ Update your po file with only the first file:
perl translate update fr-FR -f advsearch.tt

4/ Edit your po file and check that only the foo string is present (or
git diff).

5/ Update your po file with only the second file:
perl translate update fr-FR -f issuehistory

6/ Edit your po file and check that 2 strings are present (or git diff).

7/ Change the translation for these 2 strings and delete the fuzzy
lines.

8/ Install the first file for your language:
perl translate install fr-FR -f advsearch.tt

9/ Edit your translated file and verify the string is translated. Check
that the issuehistory.tt file is not changed.

10/ Same for issuehistory:
perl translate install fr-FR -f issuehistory

11/ stash your modification in your tt files (or reset --hard):
git stash

12/ Check in your po file that the 2 strings are commented (git diff).

13/ To finish, install all template files and check that they are
replaced correctly:
perl translate install fr-FR

Signed-off-by: Frédéric Demians <f.demians@tamil.fr>

I have squashed the both follow-up patches.

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-05-24 09:08:27 -07:00
Jonathan Druart
6525818076 Bug 9161: Translate only specific files
The previous version of tmpl_process3.pl says in the pod:

  -i, --input=SOURCE          Get or update strings from SOURCE file.
                              SOURCE is a directory if -r is also specified.

But is was not possible to specify one or more files.

This patch allows us to give one or more specific file with the -f
parameter.

for eg.:

perl tmpl_process3.pl install -i /home/koha/koha-tmpl/opac-tmpl/prog/en/modules/
    -o /home/koha/koha-tmpl/opac-tmpl/prog/fr-FR/modules/
    -s /home/koha/misc/translator/po/fr-FR-i-opac-t-prog-v-3006000.po
    -r
    -f opac-account.tt
    -f opac-main.tt

You can specify:
  -f advsearch.tt => translate all files with a filename containing
  'advsearch.tt'
or
  -f search => will translate acqui/histsearch.tt, acqui/z3950_search.tt, etc.

Bug 9161: Followup: Add a -f param for the translate script

Now you can directly call the translate script
(misc/translator/translate) with the -f parameter

eg.:
./translate install|create|update -f search.tt -f main.tt

Signed-off-by: Frédéric Demians <f.demians@tamil.fr>

I've squashed the 3 patches, and reported doc into 'translate' script.
It works as advertised.

Side note: It would be great to extend this functionnality in order to
be able to apply the translation to XSL files stored outside Koha
directories hierarchy. Useful to translate site-specific XSLs defined
with XSLTResultsDisplay, and other sysprefs.

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-05-24 09:08:25 -07:00
Jared Camins-Esakov
f04b9ec326 Fix incorrect entities in PO files
There were numerous malformed HTML entities in the PO files for various
languages. No longer.
2013-05-19 08:12:40 -04:00
D Ruth Bavousett
7b3652d8cc Translation update for 3.12.0
(cherry picked from commit a7dd685090)

Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
2013-05-18 12:35:49 -04:00
D Ruth Bavousett
63302e77b8 Language update for 3.12-RC
(cherry picked from commit 8e1e34f2fa)

Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
2013-05-15 21:57:53 -04:00
9ce862e451 Bug 10214 Add header to syspref po files
With this patch, header is created when creating a new syspref .po file
for a new language (translate create), and is added if it doesn't
already exist when updating an existing language (translate update).

To test:

(1) Create a new language syspref file:

    ./translate create -p xx-XX

    Check that there is an header

(2) Update an existing syspref file without header:

    ./translate update fr-FR

    Check that fr-FR-pref.po has a header

(3) Update an existing syspref file with header:

    Modify fr-FR-pref.po. Add an email, or whatever.

    ./translate update fr-FR

    Check that fr-FR-pref.po has a header with the manual modification

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>

Comment: Work as described. No errors.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
All tests and QA script pass.
Also tested that updated pref files can still be installed correctly.
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
2013-05-15 07:22:32 -04:00
Chris Cormack
3588e2820e Bug 6709 : Patch for testing translating .xml files
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Comment on second patch.
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
2013-05-01 06:53:38 -04:00
Katrin Fischer
0454377380 Bug 8200: Follow up - Removing unused file stats.pl
Patch removes misc/translator/stats.pl that is no
longer used and references deleted script
update.pl in same directory.

Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
2013-04-07 13:38:06 -04:00
3e72ec4acc Bug 8200 - removing misc/translator/update.pl - deprecated file
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Patch removes unused file.
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
2013-04-07 13:38:06 -04:00
Will Stokes
cc62d0c4dd Bug 7938: Added description of -v/--verbose parameter
Signed-off-by: Magnus Enger <magnus@enger.priv.no>
"perldoc misc/translator/translate" looks good and now mentions
the -v option.

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
2013-03-29 21:53:32 -04:00
koha-preprod
bc36e5ac5c Bug 5709: Add the ability to translate HTML5 placeholder text in an input field
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
2012-12-13 10:34:57 -05:00
6a4cbbba60 Bug 8633 Manage OPAC alternate templates
Modify /misc/translator/translate script in order to manage properly alternate
OPAC templates.

To test it with new 'ccsr' template:

- Create the .po file:

  ./translate create fr-FR

  Result: existing .po files are not modified. A new fr-FR-opac-ccsr.po file is
  available.

- Install all templates :

  ./translate install fr-FR

  Result: A new koha-tmpl/opac-tmpl/ccsr/fr-FR directory contains translated
  templates.

- Update .po files:

  ./translate update fr-FR

  Result: fr-FR .po files are update, include fr-FR-opac-ccsr.po

Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
2012-10-11 11:15:07 +02:00
Jared Camins-Esakov
3616eee996 Bug 8384: Some Perl scripts do not compile
Fix syntax errors preventing the scripts misc/translator/text-extract2.pl
and misc/cronjobs/thirdparty/TalkingTech_itiva_inbound.pl from compiling.

Remove misc/migration_tools/build6xx.pl entirely since it refers to
columns that no longer exist in the Koha database, and has seemingly
had broken encoding since Koha switched from CVS to git (or before!).

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
2012-07-10 10:50:58 +02:00