News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Need advise on a multilangual application

Started by white scorpion, April 24, 2006, 09:03:14 PM

Previous topic - Next topic

white scorpion

Hi all,

I wrote an application which allows driver developers to easily test their drivers.
I would like to create the program in at least dutch, english and spanish.
What i need is some kind of lookup table to prevent having to write every MessageBoxA function 3 times, once for every language.
I'm planning on using a registry key for the language selection which can be changed through the menu.

The program will read the registry key during start and will use the preferred language for the user.

Does anyone have any experience with this and could give me some useful tips on managing multiple languages?
I have 21 strings which are language specific.

Thanks in advance for your help  :bg

redskull

Can't you can store strings in resource files and then refer to them by ID#?  group them by language, and then you can just index each one like stringnum+1, +2, etc.
Just a thought
Strange women, lying in ponds, distributing swords, is no basis for a system of government

white scorpion

That's what i have been thinking of. But i'm still unsure how to use the index part.
Could you maybe give an example?

KSS

View example.

[attachment deleted by admin]

white scorpion

#4
Thanks KSS  :clap:,

This should definitely help me. I will try to implement this technique in the program.

[EDIT]Just created the language specific resource files and came to the conclusion that i need multiple lines in 1 resource.
example:

mystring db "something line 1",13,10
            db "something line 2",13,10
            db "something line 3",0


How should i go and implement this in a resource file?

've tried:

103,"string1",13,10,\
      "string2"

and

103,"string1",13,10
      "string2"

both (of course) without success.
I can understand why above won't work, but i can't figure out what it should be.
I've searched the msdn but couldn't find any reference to this.

Thanks in advance!

[/EDIT]

KSS

Hi White Scorpion,
Try to read "rc.hlp" :P :bg :toothy

[attachment deleted by admin]

white scorpion

Thanks for your reply!
I didn't know rc.hlp existed,
just took a look at it and it contains some valuable info, so i will surely read it.  :clap:


105,"This is a string test\012This should work."


Works exactly like in the rc.hlp so i'm glad that is solved, but i still have a problem since the string must be no longer then 255 bytes and has to be on one line.
Unfortunately the help text in the program is longer then this. I know i could solve it by using lstrcpy() & lstrcat, but i'm just wondering if there is another way to do so.
Can't find anything in the rc.hlp  :wink


AlchoholicSnake

Would'nt it perhaps be better to just have the strings declared somewhat like this

101,"This is a string test"
102,"This should work"

... and then simply use 21*LANGUAGE+101?
To save some work you could also make a macro that added the call to MessageBoxA and did the math and such, and then it's simple as ever and should work. But then again, is using resources really worth it? Doesnt that just bloat the program as resources tend to do text in unicode?

hutch--

Unless you want to actively switch languages, this task sounds like a set of seperate language files that the user selects at installation. The other way can be done but its a bit more messing around and if you want the language choice to be persistent, you will still need to store that choice somewhere.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

Tedd

Quote from: hutch-- on April 27, 2006, 08:45:35 AM
Unless you want to actively switch languages, this task sounds like a set of seperate language files that the user selects at installation. The other way can be done but its a bit more messing around and if you want the language choice to be persistent, you will still need to store that choice somewhere.

"GetUserDefaultLCID" may be more appropriate - no setup required!
No snowflake in an avalanche feels responsible.

ramguru

Many people say that I post not what they want, some of them even say what they want, hope this post won't injure anyone
The demo app shows how to choose between 3 different languages using menu resource and ini file...

[attachment deleted by admin]

white scorpion

Quote
Unless you want to actively switch languages, this task sounds like a set of seperate language files that the user selects at installation. The other way can be done but its a bit more messing around and if you want the language choice to be persistent, you will still need to store that choice somewhere.
Since i don't want to create an installer, the program should also be usable from a memory-stick, actively switching languages is the only option i can think of.

Quote
Many people say that I post not what they want, some of them even say what they want, hope this post won't injure anyone
The demo app shows how to choose between 3 different languages using menu resource and ini file...
This result is exactly what i want. I want to create an "on the fly" change of language with at the same time a registry key so that it will start in the language last chosen (if there is one).
What i do not want however, is using an ini file (or any other seperate language file) since it should be a one file only application.

Quote
... and then simply use 21*LANGUAGE+101?
To save some work you could also make a macro that added the call to MessageBoxA and did the math and such, and then it's simple as ever and should work. But then again, is using resources really worth it? Doesnt that just bloat the program as resources tend to do text in unicode?
Got any other suggestions then?
I'm open to all options  :bg