version 2.8
GTRANS

Detailed Description

Module that allows changing the language of an application dynamically during run-time.

Data Structures

struct  transTable
 A table containing translated strings. More...
 

Functions

const char * gtransString (const char *string)
 Get the string of the current language specified by the string of the base language. More...
 
const char * gtransIndex (unsigned index)
 Get the string at the specified index position of the current language. More...
 
void gtransSetBaseLanguage (const transTable *const translation)
 Set the base language. More...
 
void gtransSetLanguage (const transTable *const translation)
 Set the current language. More...
 

Macros

#define gt(str)   gtransString(str)
 A wrapper macro to make writing and reading translatable applications easier. More...
 

Function Documentation

const char* gtransIndex ( unsigned  index)

Get the string at the specified index position of the current language.

Getting translation strings is a lot faster using the index as an accessor rather than the string in the base language.

Parameters
[in]indexThe index of the string in the current language translation table.
Returns
The string at the given index of the current language or 0 if it doesn't exist.
void gtransSetBaseLanguage ( const transTable *const  translation)

Set the base language.

A translatable application needs to have a base language. All translations will be relative to this base language.

Parameters
[in]translationThe translation table
void gtransSetLanguage ( const transTable *const  translation)

Set the current language.

All translations will refer to the current language set by calling this function.

Parameters
[in]translationThe translation table
const char* gtransString ( const char *  string)

Get the string of the current language specified by the string of the base language.

This function will return the string of the current language that corresponds to the specified string in the base language.

This function uses strcmp() internally to compare strings.

Parameters
[in]stringThe string to translate.
Returns
The corresponding string of the current language or the string passed as a parameter if it doesn't exist.

Macro Definition Documentation

#define gt (   str)    gtransString(str)

A wrapper macro to make writing and reading translatable applications easier.

Definition at line 41 of file gtrans.h.