flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
Reverend 25 Apr 2005, 14:00
I think that one good solution for such case would be XML. Just define yourself a file specification eg.:
Code: <translation> <language>Polish</language> <version>1.0</version> <keyword="Add">Dodaj</keyword> <keyword="Subtract">Odejmij</keyword> </translation> Such a solution is imho good, when you want other people to create translations to their own language, but as you see it takes some place and reading such a thing is slower than reading binary format. Another way of doing this may look like that: Code: 1=Dodaj 2=Odejmij And such a file would be named like 'polish.lng' or something like that And the last solution that comes to my mind is using resources. You can define for example that your program would have n different strings. Than just define somewhere in program: Code: MAX_STRINGS = 100 ; this is the 'n' _ADD = 1 _SUB = 2 ... POLISH = 1 ENGLISH = 2 ... ; user picked polish language mov eax, POLISH*MAX_STRINGS ; let's read a string for 'add' add eax, _ADD invoke LoadString, [hInstance], eax, ptrBuffer, sizeof.ptrBuffer ; user picked english language mov eax, POLISH*MAX_STRINGS ; let's read a string for 'add' add eax, _ADD invoke LoadString, [hInstance], eax, ptrBuffer, sizeof.ptrBuffer And in resource definition: Code: #define MAX_STRINGS 100 #define POLISH 1 #define ENGLISH 2 #define _ADD 1 #define _SUB 2 STRINGTABLE BEGIN ((POLISH*MAX_STRINGS)+_ADD), "Dodaj" ((POLISH*MAX_STRINGS)+_SUB), "Odejmij" END Beware! All of these examples were written ad hoc so I don't assure they'll work in a way they're shown here EDIT: I forgot to say, that the last solution will take a lot of place, as all strings in resources are saved in utf-16, so every single chatracter will take 2 bytes |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.