MessageBox displaying text LTR in Hebrew environment

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a program which runs in multiple languages. The problem is that
message boxes displayed when I run my program on Hebrew still have
left-to-right reading order. This is Hebrew locale on an English Windows
machine. I know there is a constant MB_RTLREADING or osmething, but I cannot
use that as the program has to run in a number of different languages.
Shouldn't it automatically change to RTL if I change the locale to Hebrew?
Any ideas/suggestions would be most welcome.

Thanks.

-Jaya
 
Hi Jaya!
I have a program which runs in multiple languages. The problem is that
message boxes displayed when I run my program on Hebrew still have
left-to-right reading order.

Normally the text is displayed correctly even on an english windows!
Are you really sure that the text is in the right order?

A better newgroup might also be:
microsoft.public.dotnet.internationalization

--
Greetings
Jochen

My blog about Win32 and .NET
http://blog.kalmbachnet.de/
 
Shouldn't it automatically change to RTL if I change the locale to Hebrew?
And "change the locale to Hebrew" is too vague.
You can set the thread locale, user locale, system locale, UI locale, input
locale.
And, anyway, the answer is no. Because then all applications, localized into
Hebrew or not, will be RTL.

I know there is a constant MB_RTLREADING or osmething, but I cannot
use that as the program has to run in a number of different languages.
MB_RTLREADING is the solution. And you can use it.
Just write a wrapper function.

Transform this:
MessageBox( hwnd, text, title, flags );
into this:
MessageBox( hwnd, text, title, AdjustRTLFlags(flags) );

And your AdjustRTLFlags can do something like this:

UINT AdjustRTLFlags( UINT flags ) {
static int nIsRTL = -1;

switch( bIsRTL ) {
case -1:
bIsRTL = GetRTL();
break;
case 0:
flags &= ~MB_RTLREADING;
break;
case 1:
flags |= MB_RTLREADING;
break;
default:
assert(1);
}

return flags;
}

GetRTL() can get the RTL setting from resources, registry, etc.

Or you can global search-replace MessageBox with MessageBoxSmartRTL, and
MessageBoxSmartRTL does the same "magic" as the function above.
 
Jaya said:
I have a program which runs in multiple languages. The problem is that
message boxes displayed when I run my program on Hebrew still have
left-to-right reading order. This is Hebrew locale on an English Windows
machine. I know there is a constant MB_RTLREADING or osmething, but I cannot
use that as the program has to run in a number of different languages.
Shouldn't it automatically change to RTL if I change the locale to Hebrew?
Any ideas/suggestions would be most welcome.

To get Hebrew to work in English Windows, you need to go Control
Panel->Regional and Language Options->Languages Tab->Tick install files
for complex script and right-to-left languages (including Thai). Once
you've done that, the APIs work fine.

Tom
 
Hi Jaya!
I have a program which runs in multiple languages. The problem is that
message boxes displayed when I run my program on Hebrew still have
left-to-right reading order. This is Hebrew locale on an English Windows
machine. I know there is a constant MB_RTLREADING or osmething, but I cannot
use that as the program has to run in a number of different languages.
Shouldn't it automatically change to RTL if I change the locale to Hebrew?
Any ideas/suggestions would be most welcome.

I think Michael S. Kaplan has read this post and added a blog-entry
about this:

See: Just when you think you know a function...
http://blogs.msdn.com/michkap/archive/2006/01/19/514656.aspx

--
Greetings
Jochen

My blog about Win32 and .NET
http://blog.kalmbachnet.de/
 
Back
Top