Prev: How to show underlined menu shortcut letters by default for a context menu ?
Next: Reminder - Microsoft Responds to the Evolution of Community
From: Joseph M. Newcomer on 21 Jun 2010 15:32
There's an app for that.
Seriously, there are programs which will take a single executable image, and provided with
a database will morph strings that say "X" into strings that say "Y" for static controls
and STRINGTABLE and MENU entries. They mostly work.
Our European distributor uses one, and the database essentially is of the form of triples:
X: Danish: Y
X: French: Z
X: Spanish: W
X: Italian: T
where the single uppercase letters represent an entire STRINGTABLE entry, static control
text, menu text, etc.
If, when processing, it finds a string it doesn't recognize a string for a given language,
it pops out an exception list, and he calls in a translator (since, like most Europeans,
he speaks at least five languages, mostly he does this himself. But he got a Finnish
translator for that language)
Key here is to make the strings language-independent, and every message has a UNIQUE
string in a given language. Furthermore, if you use %s or %d substitutions (so you can
use CString::Format) you might consider changing to using CString::FormatMessage and using
%1, %2, etc. so you get better language independence. Never try to form a sentence out of
fragments; every message is a complete description.
We've been distributing software like this for over ten years; I don't have to do anything
at all, except answer the occasional email about what something means.
Furthermore, I consider it exceptionally bad practice to EVER use the same message ID in
more than one place in the program; every site that issues a message must issue a *unique*
message, even if ithe uniqueness is as simple as a numeric code which is included in a
generic message handler. That way, seeing the message, I know EXACTLY which line of the
program issued the message.
So although several of our products are distributed internationally, I have never had to
worry about the reosurces, resource DLLs, etc., which saves a lot of effort.
On Mon, 21 Jun 2010 11:32:37 -0700 (PDT), mfc <mfcprog(a)googlemail.com> wrote:
>a small additional question to using different languages in a sdi app
>project. At the moment I`ve created some satellite dlls - every
>resource has all dialoges included with different text strings for the
>buttons etc. It is working, but it is also very costly to update or
>add a new language...
>I hope there will be a much better method to do this - like importing
>a CSV file or a property file (like in Java)? Is this a common way to
>Moreover if I import such a file to my project at the startup, is it
>also a common method to add every text string (depended on the
>selected language) in the OnInitialUpdate() and the OnUpdate() method
>by myself or is there any mechanism getting always the correct
>textstring for each item (button etc.)?
>e.g. adding every text string by myself
>where GetLanguageTextString() will return the correct text string
>(dependent of the selected language)
>Or is there any mechanism - e.g. in the paint method of a view - to
>get always the right text string for each item dependent of the
>selected language - without the need to add every text string
Joseph M. Newcomer [MVP]
MVP Tips: http://www.flounder.com/mvp_tips.htm