localization messages<>

N

Noah Roberts

Localization is an area that I've yet to really deal with. I'm
attempting to figure out the standard library and finding the
documentation sparse at best. One particular area is the messages catalog.

I'm working in win32 using msvc++ and I stepped through the system with
a debugger. It appears that the entire localization system is broken.
All it does when you call messages::eek:pen is return a catalog initialized
with the value -1. The fact that I'm not doing anything right or wrong
seems to be utterly moot.

Can someone help me understand why this might be? Are we required to
write the entire messages system from scratch? If so, and since locales
are immutable, how are we supposed to be able to do that?? Why does
there appear to be no actual implementation of this interface that does
anything?

Here's the code if it's really necessary. I'm attempting to open the
exe itself just as a first attempt because it appears to me that the
win32 way of getting message catalogs should be in string resources.
But I really have no idea what I'm doing. Like I said, the
documentation on this stuff is really crappy...even the books, which I'm
referencing an entire PILE of. Is there a halfway decent tutorial on
this anywhere? I've spent days in google digging around finding next to
nothing. I've never seen anything so hard to get information on.


#include <iostream>
#include <locale>

using namespace std;


int main(int argc, char * argv[])
{
std::locale loc("");
std::locale old = std::locale::global(loc);
std::string n1 = old.name();
std::string n2 = loc.name();
std::messages said:

std::messages<char>::catalog cat = msgs.open("i18n-numerics.exe",loc);

if (cat != std::messages<char>::catalog(-1))
{
std::cout << "WORKED\n";
}
else
std::cout << "NO WORKY\n";

std::cin.get();

return 0;
}
 
B

Bo Persson

Noah said:
Localization is an area that I've yet to really deal with. I'm
attempting to figure out the standard library and finding the
documentation sparse at best. One particular area is the messages
catalog.
I'm working in win32 using msvc++ and I stepped through the system
with a debugger. It appears that the entire localization system is
broken. All it does when you call messages::eek:pen is return a catalog
initialized with the value -1. The fact that I'm not doing
anything right or wrong seems to be utterly moot.

There is no messages subsystem on Windows, so what is the interface to
do? Report a failure?


Bo Persson
 
L

Lance Diduck

There is no messages subsystem on Windows, so what is the interface to
do? Report a failure?

Bo Persson

There is a messages subsystem on Windows, and it is one of the better
ones. It was just never hooked up via C++ locales.
I confirmed this was not an oversight, but I never really found out
why this was overlooked. Perhaps you can bug them on MSDN about this

Lance
 
N

Noah Roberts

Lance said:
There is a messages subsystem on Windows, and it is one of the better
ones. It was just never hooked up via C++ locales.
I confirmed this was not an oversight, but I never really found out
why this was overlooked. Perhaps you can bug them on MSDN about this

Lance

Am I completely missing the point of the messages facet?

From my understanding this is for fetching strings from a catalog of
translations. Therefor I'm kind of wondering why there would have to be
a subsystem in the first place, it could be implemented rather
generically. The fact that windows has something that does this just
would mean, to me, that the std library should use that method since the
standard doesn't seem to supply one.
 
R

Rolf Magnus

And there are actually programs that use it? Most programs don't seem to
support multiple languages (in one executable), and those that do seem to
be using something else.
Am I completely missing the point of the messages facet?

From my understanding this is for fetching strings from a catalog of
translations.

That's my understanding too. The purpose seems to be similar to that of the
gettext system that's used widely on Un*x-like OSs.
Therefor I'm kind of wondering why there would have to be a subsystem in
the first place, it could be implemented rather generically. The fact
that windows has something that does this just would mean, to me, that the
std library should use that method since the standard doesn't seem to
supply one.

I'd say forget all this and just use gettext. It should work in Windows too.
 
N

Noah Roberts

Rolf said:
Noah Roberts wrote:
I'd say forget all this and just use gettext. It should work in Windows too.

Yeah, that's where I'm kind of at. I like to use the standard library
where possible, but that looks like more work than worth here. I'll use
it for the number stuff maybe...
 
L

Lance Diduck

And there are actually programs that use it? Most programs don't seem to
Yes. Word, Explorer to name a few. The system call is called
"FormatMessage"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,073
Latest member
DarinCeden

Latest Threads

Top