|
PowerBASIC Forums
![]() PowerBASIC Console Compiler
![]() Multi Language Programming
|
| next newest topic | next oldest topic |
| Author | Topic: Multi Language Programming |
|
Aldo Cavini Member |
I now start writing a PB/CC program which must work (at least) in three languages (english, italian and spanish). The program is for an exibition, hence I liked to change the language setting by a runtime click on a menu (Console Tools, etc.). Some time ago I "invented" a method to do this, where all the strings to be printed are first read into an array; the array index is a literal that matches a programming name to the effective string. This worked as follows:
Thanks in advance. Aldo ------------------ [This message has been edited by Aldo Cavini (edited October 02, 2003).] IP: Logged |
|
Michael Mattias Member |
One Resource-only DLL with STRINGTABLE for each supported language. Load DLL for current language. When you need character string, call LoadString. (You could just change your current function to be a 'wrapper' for LoadString). You could still use Excel/other spread sheet for maintenance purposes. But instead of Literal to ID the string, use a symbol with a value like..
When you need to create resource for particular language, I'm sure you could either create Excel macro/VB script or PB/other program to create a 'stringtable.h' file you could #include in your resource script. Eliminates need for an extra file. It's a thought. MCM IP: Logged |
|
Don Schullian Member |
Hi Aldo, Since you're using 3 Latin based languages you shouldn't have too much trouble (Greek & English drove me to tears) but whatever you do needs testing on both Win9x, 2k, and XP early on. I ran into massive trouble when using PBcc and had to switch to PBwin. I've come up with a solution that allows me quick access to the different languages and I can even 'swap' languages in the middle of the program. I've got an .inc file that is loaded into the code at compile time and is read into the program at run time. It looks like this:
There are 3 functions that go along with it...
In the code, to put a prompt or string onto the screen it looks something like this: PRINT fStr(%ERR_070) This all is an oversimplification of course and I'll gladly discuss it further if you wish. BTW, when you're all done the .inc file can be easlily placed into a reference file. ------------------ IP: Logged |
|
Aldo Cavini Member |
Michael, Don, thanks for the replies. Must admit both methods are good, hence I now have the problem to decide which one to use... About UNICODEs, I think it's better to use them, since Italian has accents, and Spanish has some no-standard ASCII chars. I think (correct me if I'm wrong) if I fill a file with UNICODE strings, of course they are created based on my Pc ANSI table, hence my dev Pc should correctly both write and read them. On the user Pc, there will be only an UNICODE to ANSI translation, possibly based on another ANSI table; but the result should be as good as possible to that computer. Am I wrong? ------------------ [This message has been edited by Aldo Cavini (edited October 02, 2003).] IP: Logged |
All times are EasternTime (US) | next newest topic | next oldest topic |
![]() |
|
Copyright © 1999-2005 PowerBASIC, Inc. All Rights Reserved.