Great, I'll try it.

On 17/10/14 12:22, Johan Vromans wrote:
Steve Cookson <steve.cook...@sca-uk.com> 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



Reply via email to