>> I think using language catalogs is a very flexible way to provide
>> internationalization in a program.
YES (see below)

>>  The tradeoff is a bit of
>> performance (reading the catalog) and some extra code to manage
>> everything.
it makes no difference if you load your messages from your exe
file or from an external NLS directory.


>> The benefit is you end up with *one* compiled program that
>> you use in every language instance, and it reads the message catalog
>> for the user's preferred language.
YES (se below)


> Could you please specify the "some extra code to manage everything" in
> bytes? Just curious. Is it ~500 or ~2,500?
'old' kitten implementation is ~1300 byte, but it can make difference
if it uses printf(), malloc(), and the program didn't use this before.
therefore KITTEN came also with PRF.C and TALLOC.C to have very tiny
implementations of printf(), malloc(). this have been lost over the
years, due to movement TurboC --> WATCOM, developer sloppiness, ...


now the BELOW part *cited from KITTENC.TXT:



        KITTENC - catgets/kittengets compatible resource compiler

KITTENC 'compiles' language resources to strings and attaches 
these strings to the executable program such that the program can 
retrieve these strings at execution time. This way it is enough to 
copy a file to another place WITHOUT taking care that the resources 
(in the NLS directory) are also copied.

KITTENC has 2 basic modes of operation:

   KITTENC  fdisk.exe  ATTACH NLS\fdisk.DE

attaches the german resources to fdisk.exe, and makes german the 
default language for fdisk.exe.


   KITTENC  fdisk.exe  ATTACH NLS\fdisk.??

attaches the all resources to fdisk.exe, and then requires the definition of

   SET LANG=DE

if you want german messages.

this saves a lot of disk space compared old KITTEN/NLS approach as everything
is stored in a single file with cluster slack exactly once, not once for each 
message file. also, the new runtime KITTEN.C is 600 byte smaller then the 
original
as all the intelligence, parsing etc. are done at compile time.

it's implementation also saves a few byte for each message translation call 
bcause clever;)


USAGE:

replace old KITTEN.H by new KITTEN.H
replace old KITTEN.C by new KITTEN.C

add something similar to your main() function

main(int argc, char *argv[])
{
        {
        static char nls_buffer[4000];

        kittenopen(argv[0], nls_buffer, sizeof(nls_buffer));
        }

so kitten has some room to store messages and not forcing to
call malloc().

compile

add as last step

   KITTENC  fdisk.exe  ATTACH NLS\fdisk.??

   where NLS\fdisk.?? are the aasumed language resources for your program

to your build instructions.

that should be it.

now
   set LANG=ES
and enjoy your spanish translation

********* building KITTENC.EXE  ***********

to build DOS KITTENC.EXE, run BUILD.BAT for a watcom executable

for a WINDOWS executable (and easier developing) start KITTENC.DSW
with MS Visual Studio or compatible environment.

however it should be easy to port to a diffenet environment as the process is 
as complicated as

        wcl kittenc.c kitten.c -k10000 -d0 
        if errorlevel 1 goto END
                        :: depending on OS and compiler
                        :: executables are write protected while they execute

        copy kittenc.exe temp.exe /Y
        kittenc temp.exe attach nls\kittenc.??
        copy temp.exe kittenc.exe

**************************************************


download from www.drivesnapshot.de/freedos/kittenc1.zip

the project is mostly done; time for feedback.

btw: the code for the new KITTEN is down to ~500, but requires
sprintf() and printf()



Tom





























_______________________________________________
Freedos-devel mailing list
Freedos-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-devel

Reply via email to