[Mod] Localisation [v06] [ ]

Post Reply
User avatar
sfan5
Moderator
Posts: 3944
Joined: Wed Aug 24, 2011 09:44
GitHub: sfan5
IRC: sfan5
Location: Germany

[Mod] Localisation [v06] [ ]

by sfan5 » Post

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/302 ... 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.
Last edited by sfan5 on Tue May 21, 2013 14:23, edited 1 time in total.
Mods: Mesecons | WorldEdit | Nuke & Minetest builds for Windows (32-bit & 64-bit)

User avatar
aracnus
Member
Posts: 65
Joined: Wed May 15, 2013 01:09
GitHub: aracnus
IRC: aracnus
In-game: aracnus
Location: Belo Horizonte - MG - Brazil
Contact:

by aracnus » Post

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.
Last edited by sfan5 on Wed May 15, 2013 17:53, edited 1 time in total.

User avatar
sfan5
Moderator
Posts: 3944
Joined: Wed Aug 24, 2011 09:44
GitHub: sfan5
IRC: sfan5
Location: Germany

by sfan5 » Post

Could you paste the .po file?
Mods: Mesecons | WorldEdit | Nuke & Minetest builds for Windows (32-bit & 64-bit)

User avatar
aracnus
Member
Posts: 65
Joined: Wed May 15, 2013 01:09
GitHub: aracnus
IRC: aracnus
In-game: aracnus
Location: Belo Horizonte - MG - Brazil
Contact:

by aracnus » Post

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).

User avatar
sfan5
Moderator
Posts: 3944
Joined: Wed Aug 24, 2011 09:44
GitHub: sfan5
IRC: sfan5
Location: Germany

by sfan5 » Post

I fixed the problem, redownload the latest version
Mods: Mesecons | WorldEdit | Nuke & Minetest builds for Windows (32-bit & 64-bit)

User avatar
sfan5
Moderator
Posts: 3944
Joined: Wed Aug 24, 2011 09:44
GitHub: sfan5
IRC: sfan5
Location: Germany

by sfan5 » Post

German translation added.
Mods: Mesecons | WorldEdit | Nuke & Minetest builds for Windows (32-bit & 64-bit)

User avatar
sfan5
Moderator
Posts: 3944
Joined: Wed Aug 24, 2011 09:44
GitHub: sfan5
IRC: sfan5
Location: Germany

by sfan5 » Post

French translation by Calinou added
Mods: Mesecons | WorldEdit | Nuke & Minetest builds for Windows (32-bit & 64-bit)

User avatar
Pavel_S
Member
Posts: 131
Joined: Sat Apr 06, 2013 11:43

by Pavel_S » Post

Russian translation, but it won`t work =(

User avatar
sfan5
Moderator
Posts: 3944
Joined: Wed Aug 24, 2011 09:44
GitHub: sfan5
IRC: sfan5
Location: Germany

by sfan5 » Post

What do you mean by won't work?
Syntax Error messages? Nothing happens?
Mods: Mesecons | WorldEdit | Nuke & Minetest builds for Windows (32-bit & 64-bit)

User avatar
Pavel_S
Member
Posts: 131
Joined: Sat Apr 06, 2013 11:43

by Pavel_S » Post

Game says "ModError: Failed to load and run ... \builtin.lua"

User avatar
sfan5
Moderator
Posts: 3944
Joined: Wed Aug 24, 2011 09:44
GitHub: sfan5
IRC: sfan5
Location: Germany

by sfan5 » Post

Paste the complete error, otherwise I won't be able to fix it
Mods: Mesecons | WorldEdit | Nuke & Minetest builds for Windows (32-bit & 64-bit)

User avatar
Pavel_S
Member
Posts: 131
Joined: Sat Apr 06, 2013 11:43

by Pavel_S » Post

So, I deleted

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.

User avatar
sfan5
Moderator
Posts: 3944
Joined: Wed Aug 24, 2011 09:44
GitHub: sfan5
IRC: sfan5
Location: Germany

by sfan5 » Post

Could you make a .zip file for the translation, I can add it to the list then
Mods: Mesecons | WorldEdit | Nuke & Minetest builds for Windows (32-bit & 64-bit)

User avatar
BlockMen
Developer
Posts: 768
Joined: Fri Mar 01, 2013 17:24
GitHub: BlockMen
Location: Germany

by BlockMen » Post

Awesome! Very nice mod.

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

User avatar
sfan5
Moderator
Posts: 3944
Joined: Wed Aug 24, 2011 09:44
GitHub: sfan5
IRC: sfan5
Location: Germany

by sfan5 » Post

BlockMen wrote:Awesome! Very nice mod.
Thanks!
BlockMen wrote:PS: plz change "Dreck" to "Erde" in german translation ;)
done.
Mods: Mesecons | WorldEdit | Nuke & Minetest builds for Windows (32-bit & 64-bit)

User avatar
aracnus
Member
Posts: 65
Joined: Wed May 15, 2013 01:09
GitHub: aracnus
IRC: aracnus
In-game: aracnus
Location: Belo Horizonte - MG - Brazil
Contact:

by aracnus » Post

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.

User avatar
sfan5
Moderator
Posts: 3944
Joined: Wed Aug 24, 2011 09:44
GitHub: sfan5
IRC: sfan5
Location: Germany

by sfan5 » Post

Just use pt, unfortanely I need to set a fixed length
Mods: Mesecons | WorldEdit | Nuke & Minetest builds for Windows (32-bit & 64-bit)

User avatar
kaeza
Moderator
Posts: 2162
Joined: Thu Oct 18, 2012 05:00
GitHub: kaeza
IRC: kaeza diemartin blaaaaargh
In-game: kaeza
Location: Montevideo, Uruguay
Contact:

by kaeza » Post

Your signature is not the place for a blog post. Please keep it as concise as possible. Thank you!

Check out my stuff! | Donations greatly appreciated! PayPal

User avatar
sfan5
Moderator
Posts: 3944
Joined: Wed Aug 24, 2011 09:44
GitHub: sfan5
IRC: sfan5
Location: Germany

by sfan5 » Post

Added!
Mods: Mesecons | WorldEdit | Nuke & Minetest builds for Windows (32-bit & 64-bit)

User avatar
sfan5
Moderator
Posts: 3944
Joined: Wed Aug 24, 2011 09:44
GitHub: sfan5
IRC: sfan5
Location: Germany

by sfan5 » Post

Update!
Changelog:
  • Support for multiline Strings
  • Added L.get function
Mods: Mesecons | WorldEdit | Nuke & Minetest builds for Windows (32-bit & 64-bit)

User avatar
guilleelcapoextra
Member
Posts: 70
Joined: Sat Oct 13, 2012 23:49
Location: uruguay
Contact:

by guilleelcapoextra » Post

cool mod sfan

User avatar
sfan5
Moderator
Posts: 3944
Joined: Wed Aug 24, 2011 09:44
GitHub: sfan5
IRC: sfan5
Location: Germany

by sfan5 » Post

German Translation updated to work with new Minetest versions
Mods: Mesecons | WorldEdit | Nuke & Minetest builds for Windows (32-bit & 64-bit)

User avatar
sfan5
Moderator
Posts: 3944
Joined: Wed Aug 24, 2011 09:44
GitHub: sfan5
IRC: sfan5
Location: Germany

by sfan5 » Post

Update!
Changelog:
  • Support for language codes like pt_BR (removed language code restriction)
Mods: Mesecons | WorldEdit | Nuke & Minetest builds for Windows (32-bit & 64-bit)

User avatar
aracnus
Member
Posts: 65
Joined: Wed May 15, 2013 01:09
GitHub: aracnus
IRC: aracnus
In-game: aracnus
Location: Belo Horizonte - MG - Brazil
Contact:

by aracnus » Post

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.

User avatar
sfan5
Moderator
Posts: 3944
Joined: Wed Aug 24, 2011 09:44
GitHub: sfan5
IRC: sfan5
Location: Germany

by sfan5 » Post

Redownload the .zip and try again
Mods: Mesecons | WorldEdit | Nuke & Minetest builds for Windows (32-bit & 64-bit)

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests