thanks to suggestions, but after speaking with our designer we prefer:
$item_data->{label} .= "\t'$kname'";
since my helpless little attempt to clean up acctable after mwnu definition:
my $win = Kephra::App::Window::_get();
$win->SetAcceleratorTable(Wx::AcceleratorTable->new());
did fail greatly.
the thing is now better since the old days where wxmenus with shortcuts
were really ugly with 3 kinds
of indention of keyboard shortcuts.
i have another issue. it seems to be a file-spec problem but it accured
after i updated now wxperl.
it mocks that:
Undefined subroutine utf8::SWASHGET called at
D:/src/perl/editor/dev/windistro/kephra/pre/lib/File/Spec/Win32.pm line 196
but inthis line is a simple regex and SWASHGET is providet by
utf_heavy.pl which i deliver in the all inc distro of kephra.
running it agains my local developement cpan repo makes no problems.
any suggesttions?
thanks a lot
herbert
Mark Dootson wrote:
Hi,
Yes, you are right. If you are going to use Wx::Locale to translate
all your text, then you would put 'Ctrl' in the code and provide
translation for that. Both methods will give the desired result.
But, I assume the text in this program is in locale 'de_DE' anyway and
all that is wanted is a way of forcing wxWidgets to understand that
'Strg' means 'Ctrl'.
Regards
Mark
Octavian Rasnita wrote:
Hi Mark,
Thank you for your samples. They help me also.
But I want to ask, if we use Locale, shouldn't we use "Ctrl" as usually,
then the module would need to translate it to another string, based
on the
language chosen (maybe from a configuration file)?
I've seen that Strg is hard coded in the source, and maybe it won't
change to another string if the program would use another language.
Thanks.
Octavian
----- Original Message ----- From: "Mark Dootson"
<[EMAIL PROTECTED]>
To: "herbert breunung" <[EMAIL PROTECTED]>
Cc: "wxperl-users" <[email protected]>
Sent: Monday, April 14, 2008 7:17 AM
Subject: Re: Stopping WxMenu from trying to be smart
Hi,
I've followed this up because I'm currently working on ways to
internationalize without using gettext (at least not creating my own
catalogs) and menu labels are a difficulty.
I've had a look at the wxWidgets source and the parsing of the menu
label
wraps 'ctrl', 'alt' and 'shift' in the wxTRANSLATE macro - which
means -
to get translations you need to have a gettext catalog for the current
locale with translations for 'ctrl', 'alt' and 'shift', and the labels
would have to be set using appropriate text for current locale.
In the wxWidgets source, there are gettext catalogs under the 'locale'
directory.
I edited de.po from
#: ../src/common/menucmn.cpp:197
msgid "ctrl"
msgstr "ctrl"
to
#: ../src/common/menucmn.cpp:197
msgid "ctrl"
msgstr "strg"
then compiled with
make de.mo
(actually mingw32-make as I'm on Windows)
The attached code now does exactly what you want in the correct way.
Looks
like I'll have to learn to love gettext :-(
Regards
Mark
Mark Dootson wrote:
Hi,
I think you have to use Wx::AcceleratorTable
Attached is minimal script I used to check suggestion.
Regards
Mark
herbert breunung wrote:
thanks i already tried something similiar ugly but i didnt know
that the object that making this is Wx::AcceleratorTable.
i will try to delete it or override it, since i capture key events
anyway.
tanks a lot for that tip
thanks
herbert
--------------------------------------------------------------------------------
use strict;
package MyApp;
use Wx qw(wxLANGUAGE_GERMAN);
use base qw( Wx::App );
sub OnInit {
my $self = shift;
my $locale = Wx::Locale->new(wxLANGUAGE_GERMAN);
$locale->AddCatalogLookupPathPrefix('c:\pathtolangdir');
$locale->AddCatalog('de');
my $mwin = MyFrame->new();
$self->SetTopWindow($mwin);
$mwin->Show(1);
return 1;
}
package MyFrame;
use Wx qw( :id :misc wxACCEL_CTRL );
use Wx::Event qw( EVT_MENU );
use base qw( Wx::Frame );
sub new {
my $class = shift;
my $self = $class->SUPER::new(
undef,
wxID_ANY,
'Test App',
wxDefaultPosition,
wxDefaultSize
);
$self->{menu} = Wx::Menu->new();
my $id1 = $self->{menu}->Append(wxID_ANY, "First
&Task\tStrg+T")->GetId();
my $id2 = $self->{menu}->Append(wxID_ANY, "Some &Other
Task\tStrg+O")->GetId();
my $menubar = Wx::MenuBar->new();
$menubar->Append($self->{menu}, '&File');
$self->SetMenuBar($menubar);
EVT_MENU($self, $id1, \&on_event_task);
EVT_MENU($self, $id2, \&on_event_task);
$self->Centre;
return $self;
}
sub on_event_task {
my($self, $event) = @_;
my $labeltext = $self->{menu}->GetLabelText($event->GetId);
Wx::LogMessage('Event "%s"', $labeltext);
}
package main;
my $app = MyApp->new();
$app->MainLoop;
1;