Author Topic: Localisation  (Read 879 times)

MrTAToad

  • Guest
Localisation
« 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 :

<num>=<token>,<text>

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]
[LanguageDefinition]
LanguageID=English (British)
LanguageVersion=1.0.0.0
LanguageAuthor=NicholasKingsley
0=testing,This is a test {{compiled}}
1=moo,and so is this {{output}}



[attachment deleted by admin]

MrTAToad

  • 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",
        "testing","example",
        "\0","\0"
        };
       

[attachment deleted by admin]