diff options
author | Edmund von der Burg <evdb@mysociety.org> | 2011-03-21 17:01:23 +0000 |
---|---|---|
committer | Edmund von der Burg <evdb@mysociety.org> | 2011-03-21 17:01:23 +0000 |
commit | 52d0d881006191103bd4e35537110f36938da3aa (patch) | |
tree | ed020a273ae5f1d626ef7a3c0fd1ff5992a75fea /perllib/FixMyStreet/App/View/Web.pm | |
parent | c8bea71a64db62236819d173a0b2613d7195356f (diff) |
Add more utility functions
Diffstat (limited to 'perllib/FixMyStreet/App/View/Web.pm')
-rw-r--r-- | perllib/FixMyStreet/App/View/Web.pm | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/perllib/FixMyStreet/App/View/Web.pm b/perllib/FixMyStreet/App/View/Web.pm index 9c16e0d84..e5983ea23 100644 --- a/perllib/FixMyStreet/App/View/Web.pm +++ b/perllib/FixMyStreet/App/View/Web.pm @@ -14,7 +14,7 @@ __PACKAGE__->config( ], ENCODING => 'utf8', render_die => 1, - expose_methods => ['loc'], + expose_methods => [ 'loc', 'nget', 'tprintf', ], ); =head1 NAME @@ -40,5 +40,31 @@ sub loc { return _(@args); } +=head2 nget + + [% nget( 'singular', 'plural', $number ) %] + +Use first or second srting depending on the number. + +=cut + +sub nget { + my ( $self, $c, @args ) = @_; + return mySociety::Locale::nget(@args); +} + +=head2 tprintf + + [% tprintf( 'foo %s bar', 'insert' ) %] + +sprintf (different name to avoid clash) + +=cut + +sub tprintf { + my ( $self, $c, $format, @args ) = @_; + return sprintf $format, @args; +} + 1; |