Solarus quests
1.6
Quest maker's reference
|
sol.language
lets you get and set the current language and manage language-specific data.
Like all resources (maps, sounds, etc.), each language is identified by an id (like "en"
, "fr"
) and has a human-readable description (like "English"
, "Français"
). The language id corresponds to the name of a directory with files translated in this language: dialogs, strings and images. That directory is located in the languages
directory of your quest.
The list of languages available in your quest is specified in the quest database file.
If there is only one language in your quest, then it is automatically set as the current language. Otherwise, if you have several languages, no current language is automatically set for you, and you need to call sol.language.set_language() to be able to use dialogs.
Returns the id of the current language.
nil
if no language was set.Changes the current language.
language_id
(string): The code that identifies the new language to set. It must be a valid id as defined in your quest database file.Returns the human-readable description of a language.
language_id
(string, optional): A language id (no value means the current language).Returns the list of available languages.
Returns a string translated in the current language.
There must be a current language when you call this function.
Translated strings are defined in the file text/strings.dat of the language-specific directory (e.g. languages/en/text/strings.dat
).
key
(string): Key of the string to get. The corresponding key-value pair must be defined in text/strings.dat.nil
if it does not exist.Returns a dialog translated in the current language.
There must be a current language when you call this function.
Translated dialogs are defined in the file text/dialogs.dat of the language-specific directory (e.g. languages/en/text/dialogs.dat
).
dialog_id
(string): Id of the dialog to get.nil
if it does not exist. The dialog is a table with at least the following two entries:dialog_id
(string): Id of the dialog.text
(string): Text of the dialog. The table also contains all custom entries defined in text/dialogs.dat for this dialog. These custom entries always have string keys and string values.