https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15395

Julian Maurice <julian.maur...@biblibre.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #62327|0                           |1
        is obsolete|                            |

--- Comment #63 from Julian Maurice <julian.maur...@biblibre.com> ---
Created attachment 71941
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=71941&action=edit
Bug 15395: Plural translations in templates

Provides a way to handle translation of plural forms in templates

Add Template::Toolkit plugin for Koha::I18N

Use like this:

[%# USE the plugin and define some macros %]
[% PROCESS 'i18n.inc' %]

[%# tn is the equivalent of __n %]
[%# macro names can't start with underscore, t is for "translate" %]
[% tn('item', 'items', num_items) %]

Extraction of strings from templates is a bit complicated and use
Template::Parser and PPI. Template is compiled into Perl code and then
analyzed by PPI. It is slow, but should be correct even with complex
constructions.

Add dependency to PPI

Test plan:
1. Open a template file (.tt or .inc) with your favorite text editor
2. Add the PROCESS directive mentioned above in the beginning of file
3. Use one of the t* macros defined in i18n.inc. They are used like
   their "__" equivalent, with one difference: the 'x' variants take a
   hashref instead of a hash as last parameter
4. cd misc/translator && ./translate update fr-FR
5. Open misc/translator/po/fr_FR/LC_MESSAGES/Koha.po and translate your
   string(s)
6. ./translate install fr-FR
7. Use your web browser to go to the page that should display the
   translation, change language and verify the translation is
   correct

Signed-off-by: Marc VĂ©ron <ve...@veron.ch>

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to