Scol standard library package
0.3.1
Common and usefull functions for all Scol applications
|
Localization API. More...
Functions | |
findloc (l, s) | |
loadloc (file, lang) | |
loc (s) | |
loc_check () | |
loc_clear () | |
Clear the current localisation. It should be used before to reload a language file. More... | |
loc_findloc (list, s) | |
loc_get (ref) | |
Return the translation of a given reference. If the reference is not found, the "unknown string" (see below) is returned. More... | |
loc_getDefaultLang () | |
Get the default language. By default, it is "english". More... | |
loc_getDefaultParamSymbol () | |
Return the default symbol for parameters. More... | |
loc_getLang () | |
Get the language used by this client. More... | |
loc_gets (ref, listParam) | |
Return the translation of a given reference. If the reference is not found, the "unknown string" (see below) is returned. More... | |
loc_gets2 (s, listParam) | |
loc_getUnknown () | |
Get the returned string when no reference is found. By default, it is "*". More... | |
loc_hachage (ref) | |
loc_init (file) | |
Initialize and load the language file The language is the favorite language defined in the Scol settings by the client. If not found, the default language is taken off. More... | |
loc_initEx (file, lang) | |
Initialize and load the language file The language is forced (the Scol settings choice is skipped) If not found, the default language is taken off. More... | |
loc_isLoaded () | |
Return if a language is currently loaded. More... | |
loc_loadloc (file, lang) | |
loc_loadloc2 (list) | |
loc_rebuild (list) | |
loc_setDefaultParamSymbol (str) | |
Set the default symbol for parameters. The language file should not be loaded yet. * By default, it is "##". More... | |
loc_setLangDefault (str) | |
Set the language default. By default, it is "english". It should be only called before loc_init or loc_initEx and after, if any, loc_clear. More... | |
loc_setUnknown (str) | |
Set the returned string when no reference is found. By default, it is "*". More... | |
startloc (file) | |
strloc (s, l) | |
Variables | |
typeof | loc_tabLoc =tab [[S S] r1] |
var | locDefaultlang ="english" |
var | locDefaultParam ="##" |
var | locDefaultParamSize =2 |
typeof | locLang =S |
var | locOk =0 |
var | locUnknown ="*" |
Localization API.
This API provides a method to internationalize an application.
Translators and/or contributors can easily give a translation.
For an application, a sub directory is created. Within are the translations. Each translations are named myapp.<language>.lang. For example :
myapp.english.lang myapp.french.lang myapp.russian.lang myapp.spanish.lang ...
In each file, a list of reference and translations :
REFERENCE_1 word_translated REFERENCE_2 string translated REFERENCE_3 substring_1 ## substring_2 ## substring_3 ...
Each ## will be replaced by a provided parameter, if needed. You can change this symbol as you want, see below.
See http://redmine.scolring.org/projects/tutorials/wiki/How_to_localize_a_program_in_Scol