From: mfc on
Hi,

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
do that?

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

m_btnMenu1Ok.SetButtonText(GetLanguageTextString(ID_BTN_OK));
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
manually?

best regards
Hans
From: David Webber on


"mfc" <mfcprog(a)googlemail.com> wrote in message
news:80f62160-4400-4f2e-b5fb-dbfcb6b29667(a)u7g2000yqm.googlegroups.com...

> 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.)?

I have translated copies of the dialogue box entries in my translated rc
file. It's easier that way.

I wrote myself a small utility application with:

INPUT: an english ,rc file.
plus a table of translations

OUTPUT: translated rc files.

The table of translations is a csv file with the first few columns
containing resource IDs, the next column containing the English text, and
subsequent columns containing translations into different languages.

The program took me two or three to weeks and is held together by string and
sealing wax, but it works more or less ok. It took me a few weeks to write.
(I'd have spent longer and put it up for sale, except that I didn't reckon
there was a large market for translating rc files!)

The one irritating thing is that when someone gives me a translation of a
word, and I want to see if it is suitable for other occurrences of that
word, the ampresands get in the way of searches. I need to write a vba
comparison macro which ignores the & - unless it is &&, but life is too
short :-(

Dave
--
David Webber
Mozart Music Software
http://www.mozart.co.uk
For discussion and support see
http://www.mozart.co.uk/mozartists/mailinglist.htm

From: David Ching on
"mfc" <mfcprog(a)googlemail.com> wrote in message
news:80f62160-4400-4f2e-b5fb-dbfcb6b29667(a)u7g2000yqm.googlegroups.com...
> 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
>
> m_btnMenu1Ok.SetButtonText(GetLanguageTextString(ID_BTN_OK));
> 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
> manually?
>

The way I did it is to store the localized strings in separate xml files,
one for each language. Load the appropriate xml file on startup. Each time
a window is shown, iterate its child controls looking for the child id in
the xml file; if found, read the localized string from the xml, and use
SetWindowText() to set the control's text. I put all this code into e.g. a
CLocalizedView or CLocalizedDialog or CLocalizedWnd class and overwrote the
appropriate startup methods of each one, e.g.
CLocalizedView::OnInitialUpdate() and CLocalizedDialog::OnInitDialog().
This makes it automated.

-- David

From: Mihai N. on

> The way I did it is to store the localized strings in separate xml files,
> one for each language. Load the appropriate xml file on startup.
> Each time
> a window is shown, iterate its child controls looking for the child id in
> the xml file; if found, read the localized string from the xml, and use
> SetWindowText() to set the control's text.

--1;

- Bad control/dialog sizes
- Bad fonts
- Bad font sizes
- No WYSIWYG context for translators
- Slower than native
- others

I don't recomend this method.


--
Mihai Nita [Microsoft MVP, Visual C++]
http://www.mihai-nita.net
------------------------------------------
Replace _year_ with _ to get the real email

From: Goran on
On Jun 21, 8:32 pm, mfc <mfcp...(a)googlemail.com> wrote:
> Hi,
>
> 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
> do that?

Use a localization tool. Buy it, it will pay out +/- quickly,
depending on how much you value your time ;-).

Shameless plug: at my work, we use appTranslator. It's a niche tool, I
guess, but it's not expensive, it's extremely simple, and we have no
issues with it (hi, Serge!).

Goran.