Multilanguage Programming
Author |
Message |
KG #1 / 8
|
 Multilanguage Programming
Hi, Can somebody tell me why we always have to recompile our program when we change something in our resource file ? We also have to recompile the resource file ? Does somebody have a better way to deal with multilanguage programs ? Is there a better way then using resource files ? Many thanks, Karel
|
Sat, 16 Sep 2000 03:00:00 GMT |
|
 |
László Juhás #2 / 8
|
 Multilanguage Programming
Hi, My experience is that the easiest way to make multilanguage programs is using language files. The language files are simple text files, the sentences are line by line. Each Language has a file, the identifyer is the extension Example : File 1 for English Name: XXXXXX.ENG Content : Hello How are you? ... ... ... File 2 for Hungarian Name: XXXXXX.HUN Content : Szia Hogy vagy? ... ... ... On program start you read the language file you want line by line into an array (eg LAN() as string) If you read the ENG file LAN(1)="Hello", LAN(2)="How are you?" Then Use the array elements for texts, captions etc. Advantages : -Never have to recompile the program -You can change the language run time if you want, reloading a new lan file -Anybody is able to add new different language to your program, translating an existing LAN file line by line into a new file with different extension Here is my Language reader routine: Public LAN() As String Public LANmax As Integer Sub ReadLan(Filename As String) Dim FNum, sor On Error GoTo readlan_err LANmax = 0 FNum = FreeFile Open Filename For Input Lock Read As FNum While Not EOF(FNum) LANmax = LANmax + 1 ReDim Preserve LAN(LANmax) Line Input #FNum, sor LAN(LANmax) = Trim$(sor) Wend Close FNum Exit Sub readlan_err: language$ = ENG Resume readlan_ki readlan_ki: ReadLan ("sfwrocl.ENG") 'Default Language file End Sub
|
Sat, 16 Sep 2000 03:00:00 GMT |
|
 |
Uwe Hercks #3 / 8
|
 Multilanguage Programming
Quote: >Hi, >Can somebody tell me why we always have to recompile our program when >we change something in our resource file ? We also have to recompile the >resource >file ? >Does somebody have a better way to deal with multilanguage programs ? >Is there a better way then using resource files ?
Hello, the better way for multilanguage programs seems to be not using VB. Rember the poor support of different locales in VB, Format writes a decimal point or a comma, but Val only accepts a point independent from the used locale. But CDbl or CSngl accept a decimal point or a comma depending on the locale. VC has functions like setlocale or getlocale. If this functions are used, the same program may use points or commas depending on locale without recompilation. I am experimenting on how to use the formating functions for input and output available within VC with a VB program. It is not easy, but I had some partial success. The problem is the support of different types and different numbers of parameters to that functions. But that was all about the different number and date and time formats. The other problems is different strings for your menus, labels etc. in all supported languages. If you have all strings needed by your program in your resources files and for all suported languages, you may write a self adapting program. At start it should checked the system setting for language and refer to the proper section of the resource file. You have to organize your resource with a certain offset for all languages. For instance 1 to 100 are US english strings, 101 to 200 are UK english strings, 201 to 300 french, 301 to 400 fl?misch, 401 to 500 wallonisch, 501 to 600 deutsch. I have an example of such a program from a good german book about VB. Good luck and by. Uwe Uwe Hercksen
For EMail response, please use: User: hercksen sub-domain: zew domain: uni-erlangen country: de -------------------------------------------------- Elektronikwerkstatt Uni. Erlangen Cauerstr. 5 D91058 Erlangen
|
Sat, 16 Sep 2000 03:00:00 GMT |
|
 |
Jose Luis Pe? #4 / 8
|
 Multilanguage Programming
I suppose you have already solved the questions about date and number formatting, etc. After beeing using VB resource files I have created my own resource file system. The way VB manages resources has various problems: VB compiles resources within the EXE file, so if you want a program in 45 languages you must create 45 EXE files (which could fit on a CD-ROM, but don't forget the compiling time). VB is limited to about 32000 text resources in a project. By the other hand, VB lets you use non-text resources, like bitmaps, etc. In my experience, the most important are text resources. What I recommend you is to create a MS-Access database with all the text resources, with records like: ResourceNumber,LanguageID,ResourceText And make a little program in VB that edits and compiles theese resources in a binary file "open for binary". One file per language. This binary file should have a header table of resources, like: File position Contents 1-4 Offset of beginning of resource No 1 5-6 Length of resource No 1 7-10 Offset of beginning of resource No 2 11-14 Length of resource No 2 Consider: - This resource system will allow more than 32000 resources for an EXE (resource number is a long) - If you do it right and put ALL your literals (menu captions included) in the resource file, you will only need to distribute an EXE and one resource file for language. - With a well-designed resource reading routine, the performance is very similar to the VB resource system. - Other things you may discover... Hope this help you. I know this is only an outline, but I'm not permitted to tell more details. Jose Luis.
Quote: >Hi, >Can somebody tell me why we always have to recompile our program when >we change something in our resource file ? We also have to recompile the >resource >file ? >Does somebody have a better way to deal with multilanguage programs ? >Is there a better way then using resource files ? >Many thanks, >Karel
|
Sat, 16 Sep 2000 03:00:00 GMT |
|
 |
Mark Lewi #5 / 8
|
 Multilanguage Programming
Do you not have to recompile your program when you correct a spelling error on a label or fix a bug??? You just treat it like any other fix. Incidently, a couple of people who responded seemed to imply you need a different resource file file for each language and/or make a separate EXE for each. That's not true. You just add an extra column in the file for each language. I find the whole process amazingly simple, practical and efficient for large applications. Mark Lewis "There are always alternatives" Corporate Consultants www.ccxpress.com <e-mail replies are trashed without being seen> Quote: >Hi, >Can somebody tell me why we always have to recompile our program when >we change something in our resource file ? We also have to recompile the >resource >file ? >Does somebody have a better way to deal with multilanguage programs ? >Is there a better way then using resource files ? >Many thanks, >Karel
|
Sat, 16 Sep 2000 03:00:00 GMT |
|
 |
Boudewij #6 / 8
|
 Multilanguage Programming
Quote: > Incidently, a couple of people who responded seemed to imply you need a > different resource file file for each language and/or make a separate EXE > for each. That's not true. You just add an extra column in the file for each > language. > I find the whole process amazingly simple, practical and efficient for large > applications.
there is one more way: use dll-like structures so as to only change appropriate dll's
|
Sun, 17 Sep 2000 03:00:00 GMT |
|
 |
Wilco van Drie #7 / 8
|
 Multilanguage Programming
I cracked the same problem but did it without a database. I have a simple textfile for each language and it contains basically a list of resource-ids and the accompanying text. At the start of my program I read the entire file to memory and when I need a text I binary-search on my internal array (the resource-ids are sorted). It gives me much better performance than accessing a database, and less overhead. All my forms have a public FormInit-procedure implemented, and by doing this I have ability to change the language runtime. Regards, Wilco Jose Luis Pe?a heeft geschreven in bericht ... Quote: >I suppose you have already solved the questions about date and number >formatting, etc. >After beeing using VB resource files I have created my own resource file >system. The way VB manages resources has various problems: >VB compiles resources within the EXE file, so if you want a program in 45 >languages you must create 45 EXE files (which could fit on a CD-ROM, but >don't forget the compiling time). >VB is limited to about 32000 text resources in a project. >By the other hand, VB lets you use non-text resources, like bitmaps, etc. >In my experience, the most important are text resources. What I recommend >you is to create a MS-Access database with all the text resources, with >records like: >ResourceNumber,LanguageID,ResourceText >And make a little program in VB that edits and compiles theese resources in >a binary file "open for binary". One file per language. This binary file >should have a header table of resources, like: > File position Contents > 1-4 Offset of beginning of resource No 1 > 5-6 Length of resource No 1 > 7-10 Offset of beginning of resource No 2 > 11-14 Length of resource No 2 >Consider: >- This resource system will allow more than 32000 resources for an EXE >(resource number is a long) >- If you do it right and put ALL your literals (menu captions included) in >the resource file, you will only need to distribute an EXE and one resource >file for language. >- With a well-designed resource reading routine, the performance is very >similar to the VB resource system. >- Other things you may discover... >Hope this help you. I know this is only an outline, but I'm not permitted to >tell more details. >Jose Luis.
>>Hi, >>Can somebody tell me why we always have to recompile our program when >>we change something in our resource file ? We also have to recompile the >>resource >>file ? >>Does somebody have a better way to deal with multilanguage programs ? >>Is there a better way then using resource files ? >>Many thanks, >>Karel
|
Sun, 17 Sep 2000 03:00:00 GMT |
|
 |
cente #8 / 8
|
 Multilanguage Programming
I use a database in access so the customer is able to make some changes for VB4 16 bits I use Access 2.0
Quote: > Hi, > Can somebody tell me why we always have to recompile our program when > we change something in our resource file ? We also have to recompile the > resource > file ? > Does somebody have a better way to deal with multilanguage programs ? > Is there a better way then using resource files ? > Many thanks, > Karel
|
Tue, 26 Sep 2000 03:00:00 GMT |
|
|
|