Article View: comp.os.ms-windows.programmer.misc
Article #1737Re: Programming for foreign languages
From: torstein hansen
Date: Mon, 14 Dec 1992 18:17
Date: Mon, 14 Dec 1992 18:17
70 lines
3477 bytes
3477 bytes
In article <1992Dec12.185658.13375@serval.net.wsu.edu> rnelson@wsuaix.csc.wsu.edu (roger nelson;S23487) writes:
I have written several DOS apps I can compile versions for English, Spanish,
French and Italian (someday also Castilan, Swedish, Danish and German)
I am porting these to ms-windows and would like no know
what is the best way to support foreign languages under windows.
I am using both Borland C++ w/AF and Borland Pascal for windows, and
am new to windows programming.
Presently I keep a file of constant declarations (Pascal) or #defines (C)
and include the file for the respective language at compile time.
I would prefer to sort out the language stuff at runtime because most
of my users want to be able to switch to another language but not have
to install a different version.
But I don't want to take up space to read in the language strings.
The list of language strings must be easy to maintain and reorganize
since I have several hundred phrases for each language and I often add
new phrases.
Does windows provide a facility for loading the strings for the language.
So far, all I have found in the Borland documentation is the function
which gets the language version of MS-Windows.
Also is there a way to access strings used by windows so I don't have to
duplicate translations for things like: ('file not found', 'unable to
open file', 'file','close','save', etc...
What I was planning on doing was the following:
Keep a language file for each language.
The file will have a number and a string for each phrases, ie:
1 "File not found"
2 "Save simulation file"
:
A language definition file will keep a list of program defines:
#define L_File_not_found 1
#define L_Save_simulation_file 2
:
When the program starts or when a different language is selected, the respective
file is loaded in a linked list (search tree) indexed by phrase number.
When I want to use the string I would use the following function:
translate(language,L_File_not_found)
Where language is the current language number returned by windows.
Translate would then lookup the phrase number in the search tree and
return the phrase string.
Does anyone have a better way to do this in Windows?
Thanks, Roger
You could make a resource-only DLL with the translated strings for
each of the languages you wish to support. You could then let the user
choose wich language to use at install time. See the documentation for
Borland Resource Workshop on how to make string resources.
I would recommend that you should have translations of all your
strings, as a user may run the italian version of your program on an
english version of Windows.
Good luck!
Torstein
--
Torstein Hansen
torstein@itekiris.kjemi.unit.no
Technical Details
Message-ID:
<TORSTEIN.92Dec14181739@itekiris.kjemi.unit.no>Path:
arc1-ca.pugleaf.net!sparky!uunet!mcsun!sunic!ugle.unit.no!ugle.unit.no!torsteinReferences:
<1992Dec12.185658.13375@serval.net.wsu.edu>Show Full Headers
Complete Article Headers
Newsgroups: comp.os.ms-windows.programmer.misc Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!sunic!ugle.unit.no!ugle.unit.no!torstein From: torstein@itekiris.kjemi.unit.no (torstein hansen) Subject: Re: Programming for foreign languages In-Reply-To: rnelson@wsuaix.csc.wsu.edu's message of 12 Dec 92 18:56:58 GMT Message-ID: <TORSTEIN.92Dec14181739@itekiris.kjemi.unit.no> Sender: news@ugle.unit.no (NetNews Administrator) Organization: Dept. of Chem.Eng, Norwegian Inst. of Tech References: <1992Dec12.185658.13375@serval.net.wsu.edu> Date: 14 Dec 92 18:17:39 Lines: 70