FAQ
Hello!

How do I define a macro for localization GLOBALLY? I don't like to add
MACRO to every template, nor I don't want to write c.localize() instead
of l()

Alex

Search Discussions

  • Websuche :: Felix Antonius Wilhelm Ostmann at Jul 25, 2011 at 9:49 am
    We are using Filters ...

    [% |loc(name) -%]
    Cool text, [_1]!
    [%- END %]

    And define the Filters in the View

    __PACKAGE__->config(
    ...
    FILTERS => { loc => [ sub { }, 1 ] }, # dynamic filter
    ...
    );

    Am 25.07.2011 11:05, schrieb Alex Povolotsky:
    Hello!

    How do I define a macro for localization GLOBALLY? I don't like to add
    MACRO to every template, nor I don't want to write c.localize() instead
    of l()

    Alex

    _______________________________________________
    List: Catalyst@lists.scsys.co.uk
    Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
    Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
    Dev site: http://dev.catalyst.perl.org/

    --
    Mit freundlichen Gr??en

    Felix Antonius Wilhelm Ostmann
    -----------------------------------------------------------
    Websuche Search Technology GmbH & Co. KG
    Martinistra?e 3, D-49080 Osnabr?ck
    -----------------------------------------------------------
    Tel.: +49 (0) 541 40666 0, Fax: +49 (0) 541 40666 22
    Email: info@websuche.de, Web: www.websuche.de
    -----------------------------------------------------------
    HRA 200252, AG Osnabr?ck, Ust-IdNr.: DE814737310
    -----------------------------------------------------------
    Komplement?rin: Websuche Search Technology Verwaltungs GmbH
    HRB 200359, AG Osnabr?ck, Gesch?ftsf?hrer: Ansas Meyer
    -----------------------------------------------------------

    Die in dieser Email enthaltenen Informationen sind vertrau-
    lich zu behandeln und ausschlie?lich f?r den Adressaten be-
    stimmt. Jegliche Ver?ffentlichung, Verteilung oder sonstige
    in diesem Zusammenhang stehende Handlung wird ausdr?cklich
    untersagt.
  • Octavian Rasnita at Jul 25, 2011 at 10:22 am
    From: "Alex Povolotsky" <tarkhil@over.ru>
    Hello!

    How do I define a macro for localization GLOBALLY? I don't like to add
    MACRO to every template, nor I don't want to write c.localize() instead of
    l()

    Alex


    I use the following settings in the app configuration file:

    'View::TT' => {
    PRE_PROCESS => ['locale_date_datetime.tt'],
    };

    And in the template locale_date_datetime.tt I put:

    [% MACRO l(text,args) BLOCK; c.localize(text,args) || text; END ~%]

    This template is loaded automaticly and in any other template I can use:

    [% l('Text to translate') %]

    or

    [% l('Text to [_1] translate [_2]', [var1, var2]) %]

    In the same template locale_date_datetime.tt I also use other global macros
    for printing the DateTime dates in different formats so it can be used for
    other things also...

    Octavian

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupcatalyst @
categoriescatalyst, perl
postedJul 25, '11 at 9:05a
activeJul 25, '11 at 10:22a
posts3
users3
websitecatalystframework.org
irc#catalyst

People

Translate

site design / logo © 2022 Grokbase