Scol standard library package
0.3.1
Common and usefull functions for all Scol applications
|
Functions | |
loc_clear () | |
Clear the current localisation. It should be used before to reload a language file. More... | |
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_getUnknown () | |
Get the returned string when no reference is found. By default, it is "*". More... | |
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_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... | |
This API provides a way to localize (internationalize) strings. 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.
Package to load : lib/loc/loc.pkg
loc_get | ( | ref | ) |
Return the translation of a given reference. If the reference is not found, the "unknown string" (see below) is returned.
Prototype: fun [S] S
S | : a reference |
loc_gets | ( | ref | , |
listParam | |||
) |
Return the translation of a given reference. If the reference is not found, the "unknown string" (see below) is returned.
Prototype: fun [S [S r1]] S
S | : a reference |
[S | r1] : a list of strings to replace parameters (in the same order) |
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.
Prototype: fun [S] I
S | : a base pathname (like "tutorials/lang/mylocapp") i.e. without language name nor extension (see above) |
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.
Prototype: fun [S S] I
S | : a base pathname (like "tutorials/lang/mylocapp") i.e. without language name nor extension (see above) |
S | : the language |
loc_clear | ( | ) |
Clear the current localisation. It should be used before to reload a language file.
Prototype: fun [] I
loc_setUnknown | ( | str | ) |
Set the returned string when no reference is found. By default, it is "*".
Prototype: fun [S] S
S | : a string |
loc_getUnknown | ( | ) |
Get the returned string when no reference is found. By default, it is "*".
Prototype: fun [] S
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.
The default language is used when other langauage files are unknown or invalid. Thus, the default language file should always exist.
Prototype: fun [S] S
S | : a default language |
loc_getDefaultLang | ( | ) |
Get the default language. By default, it is "english".
Prototype: fun [] S
loc_getLang | ( | ) |
Get the language used by this client.
Prototype: fun [] S
loc_getDefaultParamSymbol | ( | ) |
Return the default symbol for parameters.
By default, it is "##". *
Prototype: fun [] S
loc_setDefaultParamSymbol | ( | str | ) |
Set the default symbol for parameters. The language file should not be loaded yet. * By default, it is "##".
Prototype: fun [S] S
loc_isLoaded | ( | ) |
Return if a language is currently loaded.
Prototype: fun [] I