Re: messabebox(...) v afxmessanebox
That's a clever idea. You could use constants for the English values (keys)
as well so they don't have to get propagated all over. However, if you're
going to go to all the trouble of duplicating the built in mechanism :o)
Why not just assign IDs as indexes into the vector to add or retrieve the
Then just have a dimension for each language.
Wouldn't that be easier to manage and read?
In my ASP.NET application I use RESX files and I find those to be quite
handy to manage (XML). I don't think it's particularly fast to look up
strings since the key is really another string, but it doesn't seem to be
incredibly slow either so who knows.
This exercise has gotten my brain working :o) I guess I'd still use a
string table in a Unicode based .RC file, but if all you had were error
messages or something like that I could see wanting to keep them in a
separate file to ease the translator's burden... something like the file
resgen can convert (.TXT) which yields:
sort of syntax would be a nice way of storing the values. If one ever needs
other resources (dialogs, menus, etc.) then a more robust method would be
more logical IMHO.
"Giovanni Dicanio" <email@example.com> wrote in message
"Roger Rabbit" <firstname.lastname@example.org> ha scritto nel messaggio
Vectors are a Standard Template way of dealing with strings. There are so
many ways to manage strings.
I saw code that used std::map to implement string internationalization.
It was kind of map< string, wstring > (i.e. map from a ASCII string to a
In source code, the strings were written as plain English strings (so
ASCII is fine, so std::string is fine to store them). Using a proper map
(map instance depended on language choosen for localization), the actual
English ASCII string was mapped to the localized (Unicode) string.
This allowed to write code like:
ShowSomeMessage( GLS( "Hello world" ) );
The GLS was a function that went into proper map, passed the input English
string as key, and returned the localized Unicode wstring, e.g. kind of:
std::wstring GLS( const char * s );
This may make the code more readable, at least IMHO I prefer reading
verbose strings like "Hello world" than IDs like IDS_HELLO (particularly
with more complicated and longer messages).