Koha/misc
Bernardo Gonzalez Kriegel 0f5d14f707
Bug 10492: Translation problems with TT directives in po files
This patch implements the replacement of TTvariables
'[%...%]' with normal placeholders '%s' for text
inside HTML tags (eg. img, meta, input)

The replacement is done in two files:
* xgettext.pl, used on create/update, so TTvars are not
found on the text to translate (msgid)
* tmpl_proccess3.pl, used on install time, so the correct
translation is found (msgstr) and the right TTvar is put on
the translated text.

To test:
Before applying the patch
1) Update your favorite language
   cd misc/traslator
   perl translate update xx-YY

2) Build a list (ini.txt) of 'msgid' to do a comparison
   msgcat --no-wrap --use-first po/xx-YY-*po -o - | egrep "^msgid" | sort > ini.txt

3) Apply the patch

4) Update your favorite language, again
   cd misc/traslator
   perl translate update xx-YY

5) Build a final list (end.txt) of 'msgid' to do a comparison
   msgcat --no-wrap --use-first po/xx-YY-*po -o - | egrep "^msgid" | sort > end.txt

6) Compare both files, you must find (most) TTvars replaced by '%s'
   diff ini.txt end.txt

   for example:
   < msgid "Translate item type [% itemtype.itemtype | html %]"
   > msgid "Translate item type %s"

   < msgid "Holds on this item: [% item_loo.item_holds | html %] / Total holds on this record: [% item_loo.holds | html -%]"
   > msgid "Holds on this item: %s / Total holds on this record: %s"

   < msgid "tag_anchor_[% innerloo.tag | html %]_[% innerloo.index | html %][% innerloo.random | html %]"
   > msgid "tag_anchor_%s_%s%s"

   < msgid "[% innerloo.tag_lib | html %] - Click to Expand this Tag"
   > msgid "%s - Click to Expand this Tag"

7) Translate one of the examples, with more than one variable if
possible, for example this text in xx-YY-staff-prog.po
   > msgid "Holds on this item: %s / Total holds on this record: %s"
Check it's not marked as 'fuzzy'

8) Apply the translation
   perl translate install xx-YY

9) Check the translated string has all variables in the right order
   edit koha-tmpl/intranet-tmpl/prog/es-ES/modules/tools/batchMod-edit.tt
   around line '187', first '[% item_loo.item_holds | html %]', then
   '[% item_loo.holds | html -%]' on this case,
   or use another example

If approved this patch can be backported to current stable
versions.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2019-08-05 11:32:49 +01:00
..
admin Bug 23193: Make set_password.pl use Koha::Script 2019-06-28 14:34:13 +01:00
bin Revert Bug 11081 - Port Koha::Contrib::Tamil indexer into Koha code base 2016-03-01 16:56:35 +00:00
cronjobs Bug 22566: (QA follow-up) Fix pod complaint 2019-06-25 17:01:33 +01:00
devel Bug 23191: (follow-up) Improve output 2019-06-25 17:19:56 +01:00
interface_customization Bug 20647: (alternate) When ILL is enabled the hover effect on the ILL requests button is wrong 2018-08-10 10:38:12 +00:00
load_testing Bug 17829: Move GetMember to Koha::Patron 2017-07-10 13:14:19 -03:00
maintenance Bug 20364: Show languages from MARC21 field 041 in intranet 2019-07-15 11:28:07 +01:00
migration_tools Bug 22721: Remove frameworkcode parameter in GetMarcFromKohaField calls 2019-07-15 11:28:08 +01:00
release_notes Update release notes for the 19.05.00 release 2019-05-30 15:29:07 +00:00
search_tools Bug 22892: Remove warning from rebuild_es if --processes not passed 2019-05-15 12:10:53 +00:00
translator Bug 10492: Translation problems with TT directives in po files 2019-08-05 11:32:49 +01:00
add_date_fields_to_marc_records.pl Bug 22509: (RM follow-up) Add use of Koha::Script base class 2019-06-24 15:08:33 +01:00
batchCompareMARCvsFrameworks.pl Bug 22600: Set 'commandline' interface appropriately 2019-04-10 19:43:11 +00:00
batchdeletebiblios.pl Bug 22600: Set 'commandline' interface appropriately 2019-04-10 19:43:11 +00:00
batchDeleteUnusedSubfields.pl Bug 22600: Set 'commandline' interface appropriately 2019-04-10 19:43:11 +00:00
batchImportMARCWithBiblionumbers.pl Bug 22721: Remove frameworkcode parameter in GetMarcFromKohaField calls 2019-07-15 11:28:08 +01:00
batchRebuildBiblioTables.pl Bug 22721: Remove frameworkcode parameter in GetMarcFromKohaField calls 2019-07-15 11:28:08 +01:00
batchRebuildItemsTables.pl Bug 22721: Remove frameworkcode parameter in GetMarcFromKohaField calls 2019-07-15 11:28:08 +01:00
batchRepairMissingBiblionumbers.pl Bug 22600: Set 'commandline' interface appropriately 2019-04-10 19:43:11 +00:00
check_sysprefs.pl Bug 22600: Set 'commandline' interface appropriately 2019-04-10 19:43:11 +00:00
commit_file.pl Bug 22600: Set 'commandline' interface appropriately 2019-04-10 19:43:11 +00:00
export_borrowers.pl Bug 22600: Set 'commandline' interface appropriately 2019-04-10 19:43:11 +00:00
export_records.pl Bug 20485: Don't account for items timestamps when items not included 2019-05-10 17:22:27 +00:00
exportauth.pl Bug 22600: Set 'commandline' interface appropriately 2019-04-10 19:43:11 +00:00
import_patrons.pl Bug 22875: Document verbose option in import_patrons 2019-05-15 12:10:53 +00:00
koha-install-log Bug 14302: Remove GRS1 specific code 2018-08-31 11:24:20 +00:00
kohalib.pl Bug 9978: Replace license header with the correct license (GPLv3+) 2015-04-20 09:59:38 -03:00
link_bibs_to_authorities.pl Bug 21957: Add a flag to ModBiblio to avoid linking auths if called from linker 2019-04-18 10:02:03 +00:00
mod_zebraqueue.pl Bug 22600: Set 'commandline' interface appropriately 2019-04-10 19:43:11 +00:00
perlmodule_ls.pl
perlmodule_rm.pl
recreateIssueStatistics.pl Bug 22600: Set 'commandline' interface appropriately 2019-04-10 19:43:11 +00:00
sax_parser_print.pl Bug 17626 (QA followup) 2016-11-22 11:29:07 +00:00
sax_parser_test.pl Bug 6752: Be stricter with utf-8 encoding of output 2012-01-27 12:11:06 +01:00
sip_cli_emulator.pl Bug 16757 - Add support for Fee Paid to SIP cli emulator for testing 2017-03-31 13:56:37 +00:00
stage_file.pl Bug 22600: Set 'commandline' interface appropriately 2019-04-10 19:43:11 +00:00