This mod are just here pour help you to translate easily your text and names.
Features
This mod supports messages with inner parameters from 0 up to 9 placeholders.
The minetest settting 'language' is used for the choice of the language and is set by default to EN if absent from your minetest.conf.
This mod allows Patch Language for mods using this mod (see the readme for details).
License : LGPL -- http://www.gnu.org/licenses/lgpl-2.1.html
Download link http://github.com/Jonjeg/localisation/zipball/master
GitHub : https://github.com/Jonjeg/localisation
Dependancy : None
Exemple (from the README.txt):
Translations
Code: Select all
local translations = {
EN = {
message1 = "english version",
message_with_parameter = "$1 will be replaced by the first additionnal parameter",
message_existing_in_english_only = "lorem ipsum"
...etc
},
FR = {
message1 = "version française"
message_with_parameter = "$1 va être remplacé par la 1ère valeur additionnelle"
message_with_some_parameters = "$1,$2,$3"
}
}
Code: Select all
localisation.register_translations("your_mod_name",your_var_containing_translations)
Code: Select all
localisation.translate("your_mod_name:message1") -> "english version" -- si language = EN
localisation.translate("your_mod_name:message1") -> "version française" -- si language = FR
localisation.translate("your_mod_name:message1") -> "english version" -- si language = other than FR
localisation.translate("your_mod_name:message_existing_in_english_only") -> "lorem ipsum"
localisation.translate("your_mod_name:message_with_parameter","value") -> "value will be replaced by the first additionnal parameter" -- si language = EN
localisation.translate("your_mod_name:message_with_parameter","value") -> "value va être remplacé par la 1ère valeur additionnelle" -- si language = FR
localisation.translate("your_mod_name:message_with_some_parameters","value",2,3.5) -> "value,2,3.5"
localisation.translate("your_mod_name:message_inexistant","value",2,3.5) -> "Translate(EN,message_inexistant) = No translations available" -- si language = EN
localisation.translate("bad_message_without_mod_name","value",2,3.5) -> "No mod_name specified or other error message"