|
From: S. A. <san...@on...> - 2001-12-11 14:37:31
|
Ok, but it seems common sense not to do bad things !!! in my configuration, there is somewhere on the disk, the language file and it is loaded only once .(this could be done the first time a program uses the FOX library). But we prevented the next problem : a default message is displayed if you do not have the right message file : default text : "undefined message" will be displayed. We agree it is not completely safe, but you know that there is always a compromise between safety and ease of use ! Bye Steph. You have Theo Veenker wrote: > "S. Ancelot" wrote: > > > > We solved this problem (Windows and unix) using runtime loading as follow : > > > > 1) A text file contains all text messages as follow in the preferred language : > > "english.txt" > > 0:text 1 > > [st_texte_1] > > 1:Yes > > [st_es] > > > > 2) A task loads this file in a shared memory area once, and compacts it. > > you have only to load the right text file (english,french...) > > 3) each program using language texts will link to this shared area at startup > > 4) a C++ description file allows a link from the text file to shared memory ptr : > > "langue.h" file : > > #define st_texte_1 mess[0] > > #define st_yes mess[1] > > . > > . > > . > > > > 4) in the C++ code, to use it : > > #include "langue.h" -> text - ptr definition > > > > #include "init_mess.h" -> API that links to the shared memory ptr > > > > // enjoy using texts > > printf(st_texte_1); .... > > > > Advantages : > > Texts are not duplicated in each files, since they are stored in a shared memory > > area. > > Easy to use , e.g. to add a text : > > a)add the text to each language dependent text file. > > b) setup the ptr number in the langue.h file, > > c) use it in your program ! > > > > It works, we did it ! > > I believe you it works. But what happens if the message file isn't found > or doesn't match the one expected by the program or library. With all due > respect don't you agree we need absolutely fail safe message lookup handling? > > Also IMHO I don't think the message lookup 'problem' should be attacked > seperately from other i18n issues. But I may be alone here. > > Regards, > Theo |