Commit graph

57 commits

Author SHA1 Message Date
dc5fe323d2
Bug 24217: use Modern::Perl for modules when strict is missing
We absolutely need that for modules.
We are enabling strict by using Modern::Perl.
Note that other modules from C4 use strict and warnings, instead of
Modern::Perl

Test plan: git grep 2505 **/*.pm should not return any results

And let's see later what needs to be fixed.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2020-01-03 10:45:46 +00:00
Julian Maurice
e78af533df Bug 21481: (QA follow-up) Remove last reference to text-extract2
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2018-10-05 15:03:18 +00:00
017699c345 Bug 16011: $VERSION - Remove the $VERSION init
Mainly a
  perl -p -i -e 's/^.*3.07.00.049.*\n//' **/*.pm
Then some adjustements

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@unc.edu.ar>

Signed-off-by: Brendan A Gallagher <brendan@bywatersolutions.com>
2016-03-24 17:20:28 +00:00
3830d78d46 Bug 16011: $VERSION - remove use vars $VERSION
perl -p -i -e 's/^(use vars .*)\$VERSION\s?(.*)/$1$2/' **/*.pm

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@unc.edu.ar>

Signed-off-by: Brendan A Gallagher <brendan@bywatersolutions.com>
2016-03-24 17:20:26 +00: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
Paul Poulain
3752be09d3 Revert "Subroutine prototypes used at line XXX, column 1. See page 194 of PBP."
This reverts commit 583abead1b.
The translator does not work anymore after this patch has been applied, so reverting it
2012-06-11 15:38:35 +02:00
583abead1b Subroutine prototypes used at line XXX, column 1. See page 194 of PBP.
(Severity: 5)

Note: Rebased on master 06/09/2012 by jcamins
Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
2012-06-10 15:11:18 +02:00
a41100a445 Bug 6458 Template Toolkit files test case
This test validate Template Toolkit (TT) Koha files.

For the time being an unique validation is done: Test if TT files
contain TT directive within HTML tag. For example:

  <li[% IF

This kind of constuction MUST be avoided because it break Koha
translation process.

This patch transform also translation specific modules into C4 modules
in order to be able to use them in test case:

  C4::TTPaser
  C4::TmplToken
  C4::TmplTokenType

This patch is a Perl adaptation of a Haskell script from Frère Sébastien
Marie.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Notes on testing:
- translate install de-DE - worked ok
- translate update de-DE > translate install de-DE - worked ok
- running the test xt/tt_valid.t - worked ok and pointed out lots of problems.
Found no problems.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
2011-08-18 21:11:50 +12:00
e6b591d95f Improve error message when translation installation fails
For Translator Manager (myself...). A translation installation may fail because
translator hasn't enter properly string parameters (%s). With this patch, the
message ID is displayed not only the parameter.

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
2011-05-18 19:25:33 +12:00
Chris Cormack
e7caa309ed 5917 : Working on the translation script, fixing the line breakages 2011-04-19 16:13:29 +12:00
Chris Cormack
5574c350d4 Bug 5917 : Trimming leading spaces - Please test it seems to work ok
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
2011-04-18 11:37:40 +12:00
Chris Cormack
48cc802e46 Bug 5917 : More tweaks to the translation
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
2011-04-18 11:37:34 +12:00
Chris Cormack
1c5005beb2 Bug 5917 Trying to fix the js parsing for translation
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
2011-04-14 13:36:26 +12:00
Chris Cormack
312386be6e Bug 6085 : Fixing missing last tag in translation and comments, utf-8 issues to fix now
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
2011-04-11 12:58:05 +12:00
Christopher Hall
86e2fbbe49 Bug 5917 : final commit from catalyst 2011-03-30 09:05:15 +13:00
Christopher Hall
ff532faaa6 Bug 5917 : initial work on translation tool conversion 2011-03-30 09:04:34 +13:00
Chris Cormack
f5e65148ac Bug 4473: Making a change to TmplTokenizer.pm to stop translation error 2010-12-21 08:31:07 +13:00
ef5279b47c translator hack to avoid failure on opac-opensearch.tmpl
Signed-off-by: Galen Charlton <gmcharlt@gmail.com>
2010-10-06 21:01:23 -04:00
b7f886205f bug 4472: in a hackish fashion, quiet warnings about DOCTYPE in the XSLT
Signed-off-by: Galen Charlton <gmcharlt@gmail.com>
2010-10-06 17:44:34 -04:00
Donovan Jones
593a7d8e6a Bug 2505 - Add commented use warnings where missing in *.pm 2010-04-21 20:28:51 +12:00
Henri-Damien LAURENT
c04f833db0 Adding xsl strings to po
xsl strings are now taken into account.
This is a first draft.
Some parameters of the functions will be taken into account
and <xsl> tags are not translated

Signed-off-by: Galen Charlton <gmcharlt@gmail.com>
2009-09-30 11:30:13 +02:00
Marc Chantreux
01cb36effe fixed "too many opened files" error during translation
The problem was that the TmplTokenizer create global symbols to store file
handlers so the objects aren't destroyed by the garbage collector.

Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
2008-12-17 09:00:09 -06:00
acli
5c84b3411e Minor documentation correction 2004-12-30 06:53:13 +00:00
acli
2d132d2b6b Added hack to extract and translate strings inside JavaScript CDATA blocks,
using C-like _("some translatable string") notation. English templates will
need to be modified.
2004-03-10 07:00:27 +00:00
acli
507773d963 Sorry, forgot to take out debugging code before committing 2004-03-08 05:00:42 +00:00
acli
db1660f512 Fixed some bugs which caused some context to be not recognized, and some
spurious context to be recognized.  In particular, the bugs fixed are:

1. Failure to recognize INPUT element at the end, e.g., if the input has
   the form "Item number:%S", then the pattern was recognized as only
   "Item number".

2. Failure to remove matching <foo></foo> tags if the pattern contains
   INPUT or TMPL_VAR; e.g., if the input has the form "<h1>%s %s</h1>",
   the form would not be simplified to "%s %s".

Unfortunately, fixing these 2 bugs will cause about 40 fuzzies to appear.
2004-03-08 04:59:38 +00:00
acli
66775a8646 - Consider <INPUT type=text> and <INPUT type=text> part of strings.
- If a string is enclosed by a tag, remove that tag from the extracted string
- Generate automatic comments to provide more information for the translator
- A couple bug fixes
2004-02-27 13:26:07 +00:00
acli
63508b81cb This should now handle spurious "strange attribute syntax" much more sanely. 2004-02-25 08:16:24 +00:00
acli
8451615142 Ugly hack to avoid screenfuls of spurious warnings about "Possible SGML
closed tag notation"
2004-02-25 06:56:42 +00:00
acli
fc4cd326b1 Try to be a little bit more helpful with "Strange attribute syntax..."
warnings. (Actually, is syntax like foo="bar"foo="bar" actually valid?)
2004-02-25 06:49:35 +00:00
acli
3c20689a73 After the previous change, the scanner will hang if the input is malformed
in a certain way, such as having a <title> but not matching </title>.
This should fix it.
2004-02-25 06:25:29 +00:00
acli
3cc7be72c7 This should make it handle commenting out of whole blocks of HTML better.
It seems to be still correct, and it is no longer complaining about syntax
errors when seeing commented-out HTML (esp. with TMPL_* directives).

Don't try to translate stuff between <title>...</title> too, the stuff in
the middle is supposed to be PCDATA.
2004-02-25 06:08:41 +00:00
acli
3ed061c026 Fixed a bug which caused </script> to be not recognized as a tag 2004-02-23 18:49:56 +00:00
acli
dda8e7d233 Off-by-one bug 2004-02-23 04:36:56 +00:00
acli
77a1d8682d Fold all consecutive whitespaces into single blanks. This avoids problems
when minor whitespace changes occur in the original templates; it also
makes the strings much easier to read (e.g., instead of "foo\n\n\t\t  bar",
xgettext.pl will now always generate "foo bar" and tmpl_process3.pl will
understand it to be the same as the original string).
2004-02-23 01:21:03 +00:00
acli
10a00d1b50 Preliminary support for "analysis" of strings with <a> tags.
Early termination of analysis if we encounter some strings, such as </h1>
or | or ||, in order to avoid extracting strings that are unnecessarily
long and which doesn't add any meaningful context.
2004-02-22 21:34:40 +00:00
acli
03695ce811 Try to relax the criteria for allowing groups of tokens without TMPL_VAR
to be combined together into one string. This seems to have the desired
effect (that "<b>foo</b> bar" type strings are now recognized in one piece).

However, "<h1>foo</h1>\nexplanation"-type things may now also be (arguably
wrongly) recognized as one piece.
2004-02-22 09:04:53 +00:00
acli
9268d4e11c The French character handling fix for tmpl_process3 was not checked in
for some reason.

Try to remove trailing ( in strings too.
2004-02-22 08:18:27 +00:00
acli
b7150bb0c3 Ugly hack to get rid of the close tag in pathetic "foo %s</h1>"-like strings 2004-02-22 07:00:16 +00:00
acli
fb1cfd3dd3 Templates with French characters were not handled properly in the install
step. This is now fixed.
2004-02-22 06:46:15 +00:00
acli
b2138f5d0d Handle the iso8859-1 charset somewhat, so that when the po file is in
either iso8859-1 or utf8, msgmerge(1) won't crap out. The code is ugly;
the conversion table is hard-coded, and in some place not very appropriate.

However, this does fix the case where a few strings containing French
characters can't be translated. As a side effect, tmpl_process3 can now
also be used for French or other languages using iso8859-1.
2004-02-22 05:18:52 +00:00
acli
0f1c4df62a Fixed bug where a <textarea...>#cdata</textarea> on one line won't be
scanned properly.
2004-02-20 07:52:32 +00:00
acli
257b26d141 Partially allow combination of several TEXT tokens. It seems that this
gives better strings. (Always allowing combinations gives havoc, we
currently avoid this by allowing combination only if the first and last
tokens are both TEXT.)
2004-02-20 07:09:47 +00:00
acli
b6c37e376e Support %0.0s notation so that we can omit the %s as in Year%s for the
Chinese translation. (This won't work for all languages; ultimately the
English templates must be fixed.)
2004-02-20 04:38:02 +00:00
acli
0d4f569ff3 Try to not display like 40-line warnings too often 2004-02-20 02:48:39 +00:00
acli
793f49ec7f Escape ISO8859-1 characters. msgmerge still hates these strings, but at
least the po file merges.
2004-02-20 00:39:26 +00:00
acli
8b57901d85 New scripts for translation into Chinese and other languages where English
word order is too different than the word order of the target language to
yield meaningful translations.

The new scripts use a different translation file format (namely standard
gettext-style PO files).

This seems to reasonably work (e.g., producing an empty en_GB translation
then installing seems to not corrupt the "translated" files), but it likely
will still contain some bugs. There is also little documentation, but try
to run perldoc on the .p[lm] files to see what's there. There are also some
spurious warnings (both from bugs in the new scripts and from buggy third-
party Locale::PO module).
2004-02-19 21:24:30 +00:00
acli
053bb685ab Warn against Apache #include directive 2004-02-18 06:56:19 +00:00
acli
6e1a824374 The previous change was wrong. 2004-02-17 07:45:17 +00:00
acli
a9edbfe34c Allow trim to return the trimmed whitespace if the caller wants them. 2004-02-17 07:26:29 +00:00