Bugzilla – Attachment 163524 Details for
Bug 36357
Add Template::Toolkit filters for internationalization (I18N)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 36357: Add POD to Filters/I18N.pm
Bug-36357-Add-POD-to-FiltersI18Npm.patch (text/plain), 2.82 KB, created by
Kyle M Hall (khall)
on 2024-03-20 12:11:07 UTC
(
hide
)
Description:
Bug 36357: Add POD to Filters/I18N.pm
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2024-03-20 12:11:07 UTC
Size:
2.82 KB
patch
obsolete
>From 0a5274d933c3acafaeb175d85455983e0d996404 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Wed, 20 Mar 2024 12:08:18 +0000 >Subject: [PATCH] Bug 36357: Add POD to Filters/I18N.pm > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > Koha/Template/Filters/I18N.pm | 63 ++++++++++++++++++++++++++++++++--- > 1 file changed, 59 insertions(+), 4 deletions(-) > >diff --git a/Koha/Template/Filters/I18N.pm b/Koha/Template/Filters/I18N.pm >index 9f6a5806c81..5cface78651 100644 >--- a/Koha/Template/Filters/I18N.pm >+++ b/Koha/Template/Filters/I18N.pm >@@ -23,9 +23,17 @@ our $DYNAMIC_FILTERS = { > # There are two ways to fix this: > # 1. Change the order of arguments in Koha::Template::Plugin::I18N and > # change the -k options in xgettext-tt2 (the msgid must be first), or >- # 2. Use different keywords, and add them as -k options in xgettext-tt2 >+ # 2. Usesdf different keywords, and add them as -k options in xgettext-tt2 > }; > >+=head1 METHODS >+ >+=head2 fetch >+ >+Instanticate or return a ref to the filter subroutines >+ >+=cut >+ > sub fetch { > my ( $self, $name, $args, $context ) = @_; > >@@ -38,19 +46,44 @@ sub fetch { > return ( undef, Template::Constants::STATUS_DECLINED ); > } > >-# This sub is never called in theory as Template::Filters::store is called >-# first and accept all filters. >-# We declare it anyway, just in case the order of filter providers is changed >+=head2 store >+ >+This sub is never called in theory as Template::Filters::store is called >+first and accept all filters. >+We declare it anyway, just in case the order of filter providers is changed >+ >+=cut >+ > sub store { > return ( undef, Template::Constants::STATUS_DECLINED ); > } > >+=head2 t >+ >+ [% var | t %] >+ >+Translate - The simplest type of translatable string where >+there are no variables and not pluralisations to consider. >+ >+=cut >+ > sub t { > my ($msgid) = @_; > > return __($msgid); > } > >+=head2 tx_factory >+ >+ [% var | tx("hello {name}", { name = name }) %] >+ >+Mapped to the tx filter. >+ >+Translate with variable - A translatable string that >+includes a variable >+ >+=cut >+ > sub tx_factory { > my ( $context, $vars ) = @_; > >@@ -61,6 +94,17 @@ sub tx_factory { > } > } > >+=head2 tn_factory >+ >+ [% var | tn("item", "items", count) %] >+ >+Mapped to the tn filter >+ >+Translate with plural - A translatable string that needs >+singular and plural forms >+ >+=cut >+ > sub tn_factory { > my ( $context, $msgid_plural, $count ) = @_; > >@@ -71,6 +115,17 @@ sub tn_factory { > } > } > >+=head2 tnx_factory >+ >+ [% var | tnx("{count} item", "{count} items", count, { count = count }) %] >+ >+Mapped to the tnx filter >+ >+Translate with plural and variable - A translatable string >+that needs singular and plural forms and includes a variable >+ >+=cut >+ > sub tnx_factory { > my ( $context, $msgid_plural, $count, $vars ) = @_; > >-- >2.30.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 36357
:
163380
|
163381
|
163521
|
163522
|
163523
|
163524
|
163597
|
168955
|
168956
|
168957
|
168958
|
168959
|
168962
|
168963