Author Topic: Localisation  (Read 1351 times)


  • Guest
« on: 2010-Oct-06 »
I've now got a proper localisation routine :)

This is based loosely on the BlitzMax localization function - it accepts the same syntax, but not the reserved keywords or INI layout.

Essentially, a token wrapped in two curly brackets ({{}}) is regarded as a token to be replaced, so "{{test}}" could be replaced with "testing".

There are a few reserved tokens I've added :

{{docs}} - Returns the path to the Documents directory
{{what}} - Returns platform type
{{id}} - Returns computer ID
{{device}} - Returns platform device
{{compiled}} - Returns compiled time

Might add a few more later.

The format and location of an INI file is very specific.  The INI file is called LANGUAGE.INI and is always stored in /Media/Language/x, where x is a directory based on country code syntax, so the UK one would be /Media/Language/uk/LANGUAGE.INI

Each token is stored in the following way :


Where num is a ascending number (starting at 0), token is the token to be used and text is the text that will replace token.

There is also LanguageID (contains language and country name of the text), LanguageVersion is the version of the file, and LanguageAuthor is the author of the file.

An example would be :

Code: (glbasic) [Select]
LanguageID=English (British)
0=testing,This is a test {{compiled}}
1=moo,and so is this {{output}}

[attachment deleted by admin]


  • Guest
Re: Localisation
« Reply #1 on: 2010-Oct-06 »
I've updated the routine now so that a default language can be included.

The C code should be saved as defaultLanguage.c

Code: (glbasic) [Select]
char *defaultLanguage[]={
"test","this is a test",

[attachment deleted by admin]