Page 1 of 1

[Mod] Localisation [v06] [ ]

PostPosted: Tue May 14, 2013 19:54
by sfan5
Localisation Mod

This Mod adds Localisation to Lua Mods and the default Game.
This is only useful when you play in Singleplayer or when you run e.g. a Spanish Minetest Server
Code License: CC-BY-SA 2.0
Mod dependencies: none


Download: https://dl.dropboxusercontent.com/u/30267315/Minetest/localisationmod-mt-dropin.zip
How to install:
  • Drop the contents into your main minetest folder (where the folder builtin is)
  • Note: You need to overwrite builtin/builtin.lua for this to work
Configuring:
Setting the Language
To set the language open builtin/localisation.lua in an editor and change:
L.lang = "en"
to
L.lang = "<the_language_you_want>"
List of available Translations:
Installing translations: Just drop the contents of the .zip File into your Minetest folder, also don't forget to set your language


If you want me to add your Translations to the list, they must be a .zip file that looks as follows:
- something.zip
-- games
--- common
---- mods
----- bucket
------ po
------- <language>.po
----- ...
API:
-> string L.get(string)
Returns translated string, if not available returns original string.

PostPosted: Wed May 15, 2013 10:15
by aracnus
Hi sfan5, we talked yesterday about translation and this mod.

Well, as I told you, I tried it and the po's were generated, but when I left the world and enter again I get a bunch of error messages like this:

ERROR[main]: Syntax Error in /home/fred/projetos/minetest/source/minetest/bin/../games/common/mods/bucket/po/pt_BR.po


for all po files (besides "bucket", I have all others directories under games/common/mods), followed by a message that po file was read and another that no match was found. Each error repeats a number of times. Here are the lines corresponding to doors and bucket:

-snip-
no match found: 'bucket'.'pt_BR'.'Water Bucket'
06:54:01: ERROR[main]: Syntax Error in /home/fred/projetos/minetest/source/minetest/bin/../games/common/mods/bucket/po/pt_BR.po
06:54:01: ERROR[main]: Syntax Error in /home/fred/projetos/minetest/source/minetest/bin/../games/common/mods/bucket/po/pt_BR.po
06:54:01: ERROR[main]: Syntax Error in /home/fred/projetos/minetest/source/minetest/bin/../games/common/mods/bucket/po/pt_BR.po
BR.po for bucket read
no match found: 'bucket'.'pt_BR'.'Lava Bucket'


Initially I thought that was a problem with the language code (pt_BR), because of the "BR.po for bucket read" message (the "pt_" part is missing), so I changed the name to only "pt", but the problem persists.

Another information is that even Minetest is translated to pt_BR (I have "minetest.po" file under po/pt_BR and it was pulled from git) my interface is still in English. It may have anything to do with the localisation problem?

Thanks for any help.

PostPosted: Wed May 15, 2013 11:58
by sfan5
Could you paste the .po file?

PostPosted: Wed May 15, 2013 13:47
by aracnus
sfan5 wrote:Could you paste the .po file?


Here goes pt_BR.po from bucket:

#pt_BR Translation for bucket
msgid "Empty Bucket"
msgstr "Empty Bucket"

msgid "Water Bucket"
msgstr "Water Bucket"

msgid "Lava Bucket"
msgstr "Lava Bucket"


I ran msgfmt -v command and it showed me no errors, only an alert for absence of language codification (I add this information to test, but Minetest still show same errors).

PostPosted: Wed May 15, 2013 14:04
by sfan5
I fixed the problem, redownload the latest version

PostPosted: Wed May 15, 2013 14:36
by sfan5
German translation added.

PostPosted: Wed May 15, 2013 16:50
by sfan5
French translation by Calinou added

PostPosted: Wed May 15, 2013 16:59
by Pavel_S
Russian translation, but it won`t work =(

PostPosted: Wed May 15, 2013 17:00
by sfan5
What do you mean by won't work?
Syntax Error messages? Nothing happens?

PostPosted: Wed May 15, 2013 17:04
by Pavel_S
Game says "ModError: Failed to load and run ... \builtin.lua"

PostPosted: Wed May 15, 2013 17:05
by sfan5
Paste the complete error, otherwise I won't be able to fix it

PostPosted: Wed May 15, 2013 17:17
by Pavel_S
So, I deleted
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
dofile(minetest.get_modpath("__builtin").."/features.lua")
this string from builtin.lua . And now it`s working, but there is problem with encoding.

PostPosted: Wed May 15, 2013 17:21
by sfan5
Could you make a .zip file for the translation, I can add it to the list then

PostPosted: Wed May 15, 2013 17:45
by BlockMen
Awesome! Very nice mod.

PS: plz change "Dreck" to "Erde" in german translation ;)

PostPosted: Wed May 15, 2013 17:48
by sfan5
BlockMen wrote:Awesome! Very nice mod.

Thanks!
BlockMen wrote:PS: plz change "Dreck" to "Erde" in german translation ;)

done.

PostPosted: Wed May 15, 2013 18:13
by aracnus
Everything is ok now sfan5, thank you. And I have just one more question. On localisation.lua there is a comment that L.lang must be 2 characters. So, there is another way to produce a pt_BR translation instead of just pt? Brazilian Portuguese and Portugal Portuguese have many differences between some words translations.

PostPosted: Wed May 15, 2013 18:28
by sfan5
Just use pt, unfortanely I need to set a fixed length

PostPosted: Thu May 16, 2013 05:18
by kaeza

PostPosted: Thu May 16, 2013 05:25
by sfan5
Added!

PostPosted: Sun May 19, 2013 17:21
by sfan5
Update!
Changelog:
  • Support for multiline Strings
  • Added L.get function

PostPosted: Mon May 20, 2013 18:31
by guilleelcapoextra
cool mod sfan

PostPosted: Mon May 20, 2013 18:51
by sfan5
German Translation updated to work with new Minetest versions

PostPosted: Tue May 21, 2013 14:24
by sfan5
Update!
Changelog:
  • Support for language codes like pt_BR (removed language code restriction)

PostPosted: Wed May 22, 2013 01:24
by aracnus
Hi sfan5,

The last update didn't work. When I try to use it, even with "L.lang" as "pt" or "pt_BR", I get the following errors:

22:20:48: ERROR[main]: ========== ERROR FROM LUA ===========
22:20:48: ERROR[main]: Failed to load and run script from
22:20:48: ERROR[main]: /home/fred/projetos/minetest/source/minetest/bin/../games/minetest_game/mods/fire/init.lua:
22:20:48: ERROR[main]: ...test/source/minetest/bin/../builtin/localisation.lua:113: attempt to index local 'b' (a nil value)
22:20:48: ERROR[main]: stack traceback:
22:20:48: ERROR[main]: ...test/source/minetest/bin/../builtin/localisation.lua:113: in function 'create_po_entry'
22:20:48: ERROR[main]: ...test/source/minetest/bin/../builtin/localisation.lua:135: in function 'register_node'
22:20:48: ERROR[main]: ...netest/bin/../games/minetest_game/mods/fire/init.lua:3: in main chunk
22:20:48: ERROR[main]: =======END OF ERROR FROM LUA ========
22:20:48: ERROR[main]: Server: Failed to load and run /home/fred/projetos/minetest/source/minetest/bin/../games/minetest_game/mods/fire/init.lua
22:20:48: ERROR[main]: ModError: Failed to load and run /home/fred/projetos/minetest/source/minetest/bin/../games/minetest_game/mods/fire/init.lua
Could not load texture:
Quit message received.


And it doesn't generate any .po.

PostPosted: Wed May 22, 2013 05:33
by sfan5
Redownload the .zip and try again