FAQ
Hi,

default_messages don't seem to work:

-----------

<h1>*** [= Heading =] ***</h1>
<h1>*** [= Submit =] ***</h1>

-----------

would print correct thing with test.html?lang=en but only


*** Hlavicka ***


*** ***

when test.html?lang=cz

It looks like defauly messages are completely ignored. app file included
below

- Robert


-----------

@ISA = ('Embperl::App') ;

sub init {
my $self = shift ;
my $r = $self->curr_req ;
my $fdat = $r->thread->form_hash;
my $lang = $fdat->{lang} || 'en' ;
# my %messages = %{ do '/home/www/phl/etc/dict/dict.dump' };
my %messages =
(
'cz' =>
{
'Heading' => 'Hlavicka',
'Submit' => undef,
},
'en' =>
{
'Heading' => 'Heading',
'Submit' => 'Submit',
},
) ;

push @{$r->messages}, $messages{$lang} ;
push @{$r->default_messages}, $messages{'en'} if ($lang ne 'en') ;

return 0;

}

1 ;

Search Discussions

  • Gerald Richter at Dec 13, 2004 at 6:37 pm

    my %messages =
    (
    'cz' =>
    {
    'Heading' => 'Hlavicka',
    'Submit' => undef,
    You need to remove, the above line, then it will work.

    Gerald



    },
    'en' =>
    {
    'Heading' => 'Heading',
    'Submit' => 'Submit',
    },
    ) ;

    push @{$r->messages}, $messages{$lang} ;
    push @{$r->default_messages}, $messages{'en'} if
    ($lang ne 'en') ;

    return 0;

    }

    1 ;


    ---------------------------------------------------------------------
    To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
    For additional commands, e-mail: embperl-help@perl.apache.org
  • RobertCZ at Dec 14, 2004 at 10:42 am

    Gerald Richter wrote:

    my %messages =
    (
    'cz' =>
    {
    'Heading' => 'Hlavicka',
    'Submit' => undef,
    You need to remove, the above line, then it will work.
    It seems to work better, but is this practical? undef serves to
    translators so they can find fast new/modified expressions - when I
    delete them it will be necessary to add some pre/post processing of the
    dictionary to extract new stuff.

    - Robert

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupembperl @
categoriesmodperl, perl
postedDec 12, '04 at 7:25p
activeDec 14, '04 at 10:42a
posts3
users2
websiteperl.apache.org

2 users in discussion

RobertCZ: 2 posts Gerald Richter: 1 post

People

Translate

site design / logo © 2022 Grokbase