Re: Native Language Dialogue boxes.

Johan Vromans <[email protected]>
Newsgroups gmane.comp.lang.perl.wxperl
Message-ID <[email protected]>
Steve Cookson <[email protected]> writes:

> Most of you must use wxPerl in some other language than English.

I do...

> My native language is English, but I'm developing in Portuguese. When
> I switch the system language to Portuguese, some things switch (eg the
> days of the week in date-picker).  But others like help or any of the
> native dialogues remain in English.  What do I need to do?

I think this should do the trick:

    use Wx qw(wxLANGUAGE_DEFAULT wxLOCALE_LOAD_DEFAULT);
    my $local = Wx::Locale->new(wxLOCALE_LOAD_DEFAULT, wxLOCALE_LOAD_DEFAULT );
    $local->AddCatalog("app"); # replace with the appropriate catalog name

Assuming:

    use Wx::Locale gettext => '_T';

You can do thinks like:

    $self->SetTitle(_T("dialog_1"));

Stock buttons should be translated automatically, provided you use

    # Translated button text plus button icon
    $self->{button} = Wx::Button->new($self, wxID_CANCEL, "");

and not

    # Untranslated button text, no button icon
    $self->{button} = Wx::Button->new($self, wxID_CANCEL, "Cancel");

or

    # Translated button text, no button icon
    $self->{button} = Wx::Button->new($self, wxID_CANCEL, _T("Cancel"));

HTH,

-- Johan
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.