This repository has been archived by the owner on Jun 7, 2018. It is now read-only.
/
lua_api_language.dox
86 lines (63 loc) · 3.32 KB
/
lua_api_language.dox
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/**
\page lua_api_language Language functions
\tableofcontents
\c sol.language lets you get and set the current language
and manage language-specific data.
Each language is identified by a code (like \c "en", \c "fr") and has a
human-readable name (like \c "English", \c "Français").
The language code corresponds to the name of the directory with files
translated in this language (sprites, strings and dialogs).
The list of languages available in your quest is specified in the data file
\ref quest_language_list_file "languages/languages.dat".
\section lua_api_language_functions Functions of sol.language
\subsection lua_api_language_get_language sol.language.get_language()
Returns the code of the current language.
- Return value (string): The code that identifies the current language, or
\c nil if no language was set.
\subsection lua_api_language_set_language sol.language.set_language(code)
Changes the current language.
- \c code (string): The code that identifies the new language to set.
It must be a valid code as defined in
\ref quest_language_list_file "languages/languages.dat".
\subsection lua_api_language_get_language_name sol.language.get_language_name([code])
Returns the human-readable name of a language.
- \c code (string, optional): The code of a language (no value means the
current language).
- Return value (string): the human-readable name of this language.
\subsection lua_api_language_get_languages sol.language.get_languages()
Returns the list of available languages.
- Return value (table): An array of all language codes defined in
\ref quest_language_list_file "languages/languages.dat".
\subsection lua_api_language_get_default_language sol.language.get_default_language()
Returns the code of the default language.
The engine does nothing with this default language property:
it is up to you to use it like you want.
When the user doesn't have a language saved in his settings, you
can for example set the language to the default one.
Or you can show a language selection
menu where the default language will be initially selected.
- Return value (string): The code of the default language as defined in
\ref quest_language_list_file "languages/languages.dat".
Returns \c nil if no default language is specified.
\subsection lua_api_language_get_string sol.language.get_string(key)
Returns a string translated in the current language.
Translated strings are defined in the file
\ref quest_language_strings "text/strings.dat"
of the
language-specific directory (e.g. \c languages/en/text/strings.dat).
- \c key (string): Key of the string to get. The corresponding key-value
pair must be defined in
\ref quest_language_strings "text/strings.dat".
- Return value (string): The value associated to this key in
\ref quest_language_strings "text/strings.dat".
\subsection lua_api_language_get_dialog sol.language.get_dialog(key)
Returns a dialog translated in the current language.
Translated dialogs are defined in the file
\ref quest_language_dialogs "text/dialogs.dat" of the
language-specific directory (e.g. \c languages/en/text/dialogs.dat).
- \c key (string): Key of the dialog to get. This dialog must exist in
\ref quest_language_dialogs "text/dialogs.dat".
- Return value (string): The corresponding dialog in
\ref quest_language_dialogs "text/dialogs.dat".
\todo This function is not implemented yet.
*/