[Mod] Localisation [1.1] [localisation]

New member
Posts: 4
Joined: Sun Sep 30, 2012 10:38

[Mod] Localisation [1.1] [localisation]

by Jonjeg » Mon Oct 01, 2012 18:45

Here is my mod concerning the localisation of your mods.
This mod are just here pour help you to translate easily your text and names.
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):
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"
        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"

Registering the translations
Code: Select all

Usage in your code
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"

The old version(1.0) got a flaw in the point that a needed a variable to store translations and that this variable would pollute the global environment for other mods.
Last edited by Jonjeg on Thu Oct 04, 2012 11:59, edited 1 time in total.

Posts: 844
Joined: Wed Jul 11, 2012 15:02

by cornernote » Tue Oct 02, 2012 06:29

+1 this is a good idea, but can make mod development a little more tedious.

if anyone wants any of my mods to include this then I will be happy to do it, let the community demand, and it shall be given

User avatar
Posts: 106
Joined: Thu Sep 27, 2012 16:11
Location: Ohio, USA

by GJH105775 » Tue Oct 02, 2012 14:49

This would be very useful. +1
Check out my mod xtrablocks, has some different types of marble that you can build with or mine at different depths

I am not here regularly as I just kind of pop in and out. If you want to find me I'll be on quadcopterforum.com helping with multirotor builds and spending other's money haha.

http://i10.photobucket.com/albums/a119/ ... hicons.jpg

New member
Posts: 4
Joined: Sun Sep 30, 2012 10:38

by Jonjeg » Thu Oct 04, 2012 12:01

Here is an update of the mod with new features as global translations registration and language patching mods.

Return to Mod Releases

Who is online

Users browsing this forum: No registered users and 9 guests