Re: [AL] Re: Re: Re: FW: language.dat in allegro
On 2005-06-07, Michelle Konzack [EMAIL PROTECTED] wrote: Am 2005-06-07 01:05:13, schrieb Grzegorz Adam Hankiewicz: On 2005-06-03, Michelle Konzack [EMAIL PROTECTED] wrote: Thats interesting, because I have not found the language.dat in the Allegro packages of Debian GNU/Linux The poor documentation just mentions language.dat in a few places but there is no instructions as to what this file means, what it is for, and how *nix administrators should deal with it, just like the keyboard.dat file or the setup program, meant to be used by the administrator to create the global /etc/allegro.cfg. [...] [...] Do you will file the to BUGs for the documentation and the language.dat ? Ok, let's remember all the facts: Miriam Ruiz is packaging the game Kraptor for Debian, and finds that language.dat is meant to be an Allegro generic file instead of a game specific file with game strings. Proposed hacks are hijacking of ALLEGRO env in 4.0 or use of set_allegro_resource_path() for the yet to be released 4.2. Both solutions are wrong from a global point of view, because Allegro and game specific strings are mixed in the same .dat file. This means that when the Allegro library is updated, it will still use the possibly outdated strings found in the game provided language.dat. If possible, the system Allegro package should come with a language.dat and user programs should provide their translations separately. However, this is technically not possible, because Allegro doesn't support overriding one dat file with another. Such storage mechanisms are only planned, and not even sure to be included for Allegro 4.3 and above (if that version is reached). Luckily, since 3.x days Allegro provides the functions override_config_file() and override_config_data() which can help in this situation, by putting more burden on the user program. Let Kraptor use an Allegro provided language.dat file, and Kraptor provide separate game specific xxtext.cfg files. This is, if Kraptor's language.dat contains estext.cfg, entext.cfg and frtext.cfg, store those files separately in /usr/games/kraptor/xxtext.cfg. Then, in Kraptor's code just before the call to reload_config_texts(xx) new code has to be inserted. This code will use get_config_string(system, language, EN) to find out the currently selected language of the user. With the obtained language code a path can be constructed in the form of /usr/games/kraptor/xxtext.cfg and override_config_file() used on it. Thanks to override_config_file(), Allegro will be using both a global language.dat file provided by its own package, and the specific language resource overridden by Kraptor. In order to show how this mechanism works I have attached a very simple example which should demonstrate the effects of override_config_file(). For me the output is: 1 - Eje , How are you? 2 - Aim , Blahblah uno 3 - Aim , Special 1 4 - Blah special 2 , Blahblah uno 5 - Blah special 3 , Blah special 3 1 mixes Spanish (my global system setting) and a game custom string not found anywhere. 2 uses frtext.cfg in the test directory, showing how to change the language to French at runtime. Finally 3, 4 and 5 show the overriding with three files (only one at a time). 3 Has global English and special string. 4 Has special string and local string from frtext.cfg (just like 2). 5 overrides both with special strings. Note that the language override for French makes 4 output BlahBlah uno instead of How are you? as in the first line. Unfortunately this is the only method I can think of that preserves the language strings of Allegro and allows using get_config_text() with game provided files. Allegro was initially designed for mono user mono task OSes where dynamic linking wasn't possible, and thus a game update meant for the programmer to repackage again all new Allegro strings in the language.dat file. I am addressing this with the attached documentation update to both installation instructions and the programmer manual. Feel free to comment on the content of these patches and/or suggest better ways to deal with this problem. Allegro 4.0 and 4.2 are in feature freeze, so no library side change can be made unless it doesn't break the ABI. Finally, as personal opinion, I wouldn't care too much about being correct and would go with the environment hack. Even though language.dat contains Allegro text strings, these will mostly show up when something goes really wrong (if the programmer has cared to show them), and they are quite criptic for non developers. allegro_i18n_test.tar.gz Description: Binary data support_files.diff.gz Description: Binary data
Re: [AL] Re: Re: FW: language.dat in allegro
On 2005-05-29, Miriam Ruiz [EMAIL PROTECTED] wrote: It is a kraptor specific file, that includes the translation of the sentences in the game. It should be similar to what in other platforms are the .mo files Right now the game works properly at least, but I had to make a horrible hack: adding a setenv() command to define ALLEGRO environment variable at the beginning of the code. I wish I could find a more elegant solution. Elias already pointed the more elegant solution. Unfortunately that solution is only available for 4.1.x and the future 4.2.0 release. Since you are packaging this for Debian, I guess you have to live with 4.0.x for a while because static linking with the latest unstable Allegro version might not be desirable. You might want to check for the presence of the ALLEGRO environment variable before setting it, bailing out with an error message in this cause and warning the user about this conflict. Unfortunately Allegro wasn't correctly designed for i18n and 4.2.0 will still keep a few minor inconveniences around. -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]
FW: language.dat in allegro
Hello all, Miriam is packing the game Kraptor for Debian GNU/Linux and there is a problem with the path for language.dat How can we solve this ? Please respond to the Mailinglists alleg-main, debian-mentors and me parallel. Thanks Michelle - Forwarded message from Miriam Ruiz [EMAIL PROTECTED] - Date: Sat, 28 May 2005 17:56:26 +0200 (CEST) From: Miriam Ruiz [EMAIL PROTECTED] To: debian-mentors@lists.debian.org Subject: language.dat in allegro X-Mailing-List: debian-mentors@lists.debian.org archive/latest/23529 Hi, I'm packaging a game called Kraptor ( http://kraptor.sf.net ) which uses the allegro libraries. I have the package almost finished, but I'm finding a problem I cannot solve. Has any of you packaged an allegro-dependent game? The problem is the multiple languages in the game. Allegro loads a language.dat file for that. According to allegro documentation: Specifies which language file to use for error messages and other bits of system text. The parameter is the name of a translation file, and can either be a fully qualified file path or a basename like en or sp. If the latter, Allegro will look first for a separate config file with a name in the form entext.cfg, and then for an object with that name in the language.dat file (eg. ENTEXT_CFG). The config file or language.dat file can be stored in the same directory as the program, or in the location pointed to by the ALLEGRO environment variable. Look in the language.dat file to see which mappings are currently available. When I run the program with: strace kraptor 21| grep language I see it tries to access: language.dat /home/inniyah/language.dat /usr/share/allegro/language.dat /usr/local/share/allegro/language.dat But I see no way of telling the system that the file is in /usr/share/games/kraptor/language.dat. Any ideas? Greetings, Miry __ Renovamos el Correo Yahoo! Nuevos servicios, más seguridad http://correo.yahoo.es -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED] - End forwarded message - -- Linux-User #280138 with the Linux Counter, http://counter.li.org/ Michelle Konzack Apt. 917 ICQ #328449886 50, rue de Soultz MSM LinuxMichi 0033/3/8845235667100 Strasbourg/France IRC #Debian (irc.icq.com) signature.pgp Description: Digital signature
Re: FW: language.dat in allegro
This one time, at band camp, Michelle Konzack said: Hello all, Miriam is packing the game Kraptor for Debian GNU/Linux and there is a problem with the path for language.dat How can we solve this ? Please respond to the Mailinglists alleg-main, debian-mentors and me parallel. In setup.c, you call find_allegro_resource for SETUP_LANGUAGE_FILE. SETUP_LANGUAGE_FILE is #defined as language.dat, so I am assuming this is the problematic part. Taking a quick look at how find_allegro_resource works, it appears that it will search several default paths for the file, unless the full path to the file is passed. So if you are only looking for a specific file (and not also looking for a ~/.kraptor/ file or something) you can just #define the full path, it seems. Hope that's right - I don't know allegro, and just spent about 15 minutes looking at this :) Take care, -- - | ,''`.Stephen Gran | | : :' :[EMAIL PROTECTED] | | `. `'Debian user, admin, and developer | |`- http://www.debian.org | - pgpDyVTNAfVhH.pgp Description: PGP signature
Re: FW: language.dat in allegro
--- Stephen Gran [EMAIL PROTECTED] escribió: This one time, at band camp, Michelle Konzack said: Hello all, Miriam is packing the game Kraptor for Debian GNU/Linux and there is a problem with the path for language.dat How can we solve this ? Please respond to the Mailinglists alleg-main, debian-mentors and me parallel. In setup.c, you call find_allegro_resource for SETUP_LANGUAGE_FILE. SETUP_LANGUAGE_FILE is #defined as language.dat, so I am assuming this is the problematic part. Taking a quick look at how find_allegro_resource works, it appears that it will search several default paths for the file, unless the full path to the file is passed. So if you are only looking for a specific file (and not also looking for a ~/.kraptor/ file or something) you can just #define the full path, it seems. Hope that's right - I don't know allegro, and just spent about 15 minutes looking at this :) Thanks! I've tried it and it doesn't seem to work. Even though setup/setup.c routines in allegro library seem to use that #defined variable, SETUP_LANGUAGE_FILE, kraptor uses a procedure called: void reload_config_texts(AL_CONST char *new_language) which is defined in src/config.c and seems to be using language.dat in a hardcoded way: datafile = uconvert_ascii(language.dat, tmp2); I tried to #define that item at the beginning of the program and it doesn't seem to work. The only hack I found to be able to make multiple languages work in kraptor is adding in main.c the following line before calling the language stuff: setenv(ALLEGRO, /usr/share/games/kraptor/,0); But, of course, I don't like that way of fixing things at all. Might that be a bug in allegro library? Take care, -- Thanks and greetings, Miry __ Renovamos el Correo Yahoo! Nuevos servicios, más seguridad http://correo.yahoo.es -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]
Re: Re: FW: language.dat in allegro
--- Michelle Konzack [EMAIL PROTECTED] escribió: Am 2005-05-29 20:17:13, schrieb Elias Pschernig: Hm, what would be the bug? Too many hardcoded pathes inside Allegro? Hmmm, is this language.dat a allegro file or an kraptor file It is a little bit bizzar, because I have seen the language.dat in the Sources of kraptor Greetings Michelle It is a kraptor specific file, that includes the translation of the sentences in the game. It should be similar to what in other platforms are the .mo files Right now the game works properly at least, but I had to make a horrible hack: adding a setenv() command to define ALLEGRO environment variable at the beginning of the code. I wish I could find a more elegant solution. Thanks and Greetings, Miry __ Renovamos el Correo Yahoo! Nuevos servicios, más seguridad http://correo.yahoo.es -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]
Re: Re: FW: language.dat in allegro
Am 2005-05-29 20:44:43, schrieb Miriam Ruiz: It is a kraptor specific file, that includes the translation of the sentences in the game. It should be similar to what in other platforms are the .mo files Right now the game works properly at least, but I had to make a horrible hack: adding a setenv() command to define ALLEGRO environment variable at the beginning of the code. I wish I could find a more elegant solution. There is no other solution for it, because under DOS and Windows, you will have the whole Allegro Stuff for each program in its Directory... Under DOS and Windows, Allegro ist NOT shared. I have tried, to compile one of my older allegro programs and was running into the same problem as you. Thanks and Greetings, Miry Greetings Michelle -- Linux-User #280138 with the Linux Counter, http://counter.li.org/ Michelle Konzack Apt. 917 ICQ #328449886 50, rue de Soultz MSM LinuxMichi 0033/3/8845235667100 Strasbourg/France IRC #Debian (irc.icq.com) signature.pgp Description: Digital signature
Re: [AL] Re: FW: language.dat in allegro
Thanks! I've tried it and it doesn't seem to work. Even though setup/setup.c routines in allegro library seem to use that #defined variable, SETUP_LANGUAGE_FILE, kraptor uses a procedure called: void reload_config_texts(AL_CONST char *new_language) which is defined in src/config.c and seems to be using language.dat in a hardcoded way: datafile = uconvert_ascii(language.dat, tmp2); I tried to #define that item at the beginning of the program and it doesn't seem to work. The only hack I found to be able to make multiple languages work in kraptor is adding in main.c the following line before calling the language stuff: setenv(ALLEGRO, /usr/share/games/kraptor/,0); But, of course, I don't like that way of fixing things at all. Might that be a bug in allegro library? Hm, what would be the bug? Too many hardcoded pathes inside Allegro? The intented way to find language.dat is for it to reside in /usr[/local]/share/allegro/language.dat (both pathes are hardcoded), so if you update Allegro, and it includes updated translation, then all games have the updated translation. I'd assume, the Debian package of Allegro installs that file - so Kraptor need not include it. Unless it puts game specific things into it.. .. in which case, you could use something like: set_allegro_resource_path(/usr/share/games/kraptor/) http://alleg.sourceforge.net/onlinedocs/en/alleg030.html#set_allegro_resource_path -- Elias Pschernig -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]