[Mod] Internationalization Library [intllib]

Martno
Member
Posts: 80
Joined: Thu May 28, 2015 07:09
Location: Hungary

Re: [Mod] Internationalization Library [0.1.0] [intllib]

by Martno » Post

Hybrid Dog wrote:
ABJ wrote:Shame about not being able to use non-ASCII characters. I was going to make a translation into my own language when I saw that. Any way to fix?
on my pc non-ASCII characters work in minetest
They work OK for me too (menu, chat), except in case of mods that I translated with Intllib: non-ASCII are not showing, or (on Linux) I get this: "invalid UTF-8 string". Casimir's translate mod work OK by the way (but that translates only the item descriptions).
If there's any way to fix this, that would be awesome.

User avatar
BrunoMine
Member
Posts: 1082
Joined: Thu Apr 25, 2013 17:29
GitHub: BrunoMine
Location: SP-Brasil
Contact:

Re: [Mod] Internationalization Library [0.1.0] [intllib]

by BrunoMine » Post

If I want to concatenate a variable is very complicated.

Code: Select all

LUA script
S("Ola ")..playername..S(" Bem vindo ao Servidor")
locale folder
Ola\32 = Hello\32
#playername
\32Bem vindo ao Servidor = \32Welcome to Server
It should be possible to facilitate concatenation of variables with strings.

Code: Select all

LUA script
S("Ola ", playername, " Bem vindo ao Servidor")
locale folder
Ola 'VAR' Bem vindo ao Servidor = Hello 'VAR' Welcome to Server
Just a mod of example that can be used in various servers.

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:

Re: [Mod] Internationalization Library [0.1.0] [intllib]

by kaeza » Post

BrunoMine wrote:It should be possible to facilitate concatenation of variables with strings. [...]
init.lua:

Code: Select all

S("Hello @1 Welcome to Server", playername)
pt.txt:

Code: Select all

Hello @1 Welcome to Server = Ola @1 Bem vindo ao Servidor
The `@N` mark is replaced by the Nth argument to the `S()` call (after the format string itself).

For example:

Code: Select all

S("@2 @1", "hello", "world") --> world hello
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
kaeza
Moderator
Posts: 2162
Joined: Thu Oct 18, 2012 05:00
GitHub: kaeza
IRC: kaeza diemartin blaaaaargh
In-game: kaeza
Location: Montevideo, Uruguay
Contact:

Re: [Mod] Internationalization Library [0.1.0] [intllib]

by kaeza » Post

Martno wrote:[...] If there's any way to fix this, that would be awesome.
Which text editor are you using? Are you sure you're saving the file with UTF-8 encoding?
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
BrunoMine
Member
Posts: 1082
Joined: Thu Apr 25, 2013 17:29
GitHub: BrunoMine
Location: SP-Brasil
Contact:

Re: [Mod] Internationalization Library [0.1.0] [intllib]

by BrunoMine » Post

Thanks.
I want to create a PDF guide to Portuguese language.
You would include a link in README.txt?

Martno
Member
Posts: 80
Joined: Thu May 28, 2015 07:09
Location: Hungary

Re: [Mod] Internationalization Library [0.1.0] [intllib]

by Martno » Post

kaeza wrote:
Martno wrote:[...] If there's any way to fix this, that would be awesome.
Which text editor are you using? Are you sure you're saving the file with UTF-8 encoding?
Oh, thanks. That was the problem. I used the notepad on windows, which saved the text with ANSI encoding. I saved it as UTF-8 encoding, and works fine!

User avatar
Soultest
New member
Posts: 1
Joined: Sat Apr 30, 2016 05:45
IRC: Soultest
In-game: Soultest

Re: [Mod] Internationalization Library [0.1.0] [intllib]

by Soultest » Post

Hi, Kaeza.

Currently, when one tries to edit some of the target texts (i.e. S(target text)), it does not seem to update the template file automatically.

In certain cases, if one deletes the template file, it just does not regenerate it at all?

Thanks for your time.
1+2+3+4+5...=-1/12

User avatar
Glory!
Member
Posts: 92
Joined: Thu Apr 30, 2015 17:45
GitHub: Glory7000
In-game: Glory7000
Location: Kernel Debugging Land <3

Re: [Mod] Internationalization Library [0.1.0] [intllib]

by Glory! » Post

For any modders out there... I've made this:
Image
http://i.imgur.com/1bjbxmD.png - Feel free to add to your mod's page.
Behold the Razgriz, its wings of black sheath. :: My skin A competitor that unfortunately needs attention to stay afloat.

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:

Re: [Mod] Internationalization Library [0.1.0] [intllib]

by kaeza » Post

Soultest wrote:Hi, Kaeza.

Currently, when one tries to edit some of the target texts (i.e. S(target text)), it does not seem to update the template file automatically.

In certain cases, if one deletes the template file, it just does not regenerate it at all?

Thanks for your time.
The mod/library does not handle template generation/updates in any way. It is up to mod developers to do it manually.
Glory! wrote:For any modders out there... I've made this:
Image
http://i.imgur.com/1bjbxmD.png - Feel free to add to your mod's page.
Woah. Nice!

What's the license for the image? If you release it as something open source, I'll link it in the first post (with due credit, of course).
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
Glory!
Member
Posts: 92
Joined: Thu Apr 30, 2015 17:45
GitHub: Glory7000
In-game: Glory7000
Location: Kernel Debugging Land <3

Re: [Mod] Internationalization Library [0.1.0] [intllib]

by Glory! » Post

kaeza wrote:What's the license for the image? If you release it as something open source, I'll link it in the first post (with due credit, of course).
WTFPL.
Behold the Razgriz, its wings of black sheath. :: My skin A competitor that unfortunately needs attention to stay afloat.

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:

Re: [Mod] Internationalization Library [0.1.0] [intllib]

by kaeza » Post

Glory! wrote:WTFPL.
Thank you. Added note to first 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
cimbakahn
Member
Posts: 39
Joined: Sat Aug 29, 2015 20:03
IRC: cimbakahn
In-game: cimbakahn

Re: [Mod] Internationalization Library [0.1.0] [intllib]

by cimbakahn » Post

Hello Xanthin

I do believe the awards mod is supported as well, so you can add it to your list of intllib supported mods.
cdb_efde67d3a97d

User avatar
cimbakahn
Member
Posts: 39
Joined: Sat Aug 29, 2015 20:03
IRC: cimbakahn
In-game: cimbakahn

Re: [Mod] Internationalization Library [0.1.0] [intllib]

by cimbakahn » Post

Shoot! I just realized, i could be wrong. awards coughs up this message: WARNING: Undeclared global variable "intllib" accessed at ...kahn/.minetest/mods/dreambuilder_modpack/awards/init.lua:8 I thought the fact that awards knew anything about intllib ment it was supported, now i am not so sure?
cdb_efde67d3a97d

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:

Re: [Mod] Internationalization Library [0.1.0] [intllib]

by kaeza » Post

cimbakahn wrote:Shoot! I just realized, i could be wrong. awards coughs up this message: WARNING: Undeclared global variable "intllib" accessed at ...kahn/.minetest/mods/dreambuilder_modpack/awards/init.lua:8 I thought the fact that awards knew anything about intllib ment it was supported, now i am not so sure?
That warning just means `awards` is probably not (optionally) depending on `intllib` (`awards` probably gets loaded before this mod or there's something weird going on, so the global `intllib` table is not set yet). You should contact the mod's author (rubenwardy) or the game author (VanessaE) to issue a fix.
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
rubenwardy
Moderator
Posts: 6978
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy
Location: Bristol, United Kingdom
Contact:

Re: [Mod] Internationalization Library [0.1.0] [intllib]

by rubenwardy » Post

I'll fix this, I've never actually tested it sorry :P
Renewed Tab (my browser add-on) | Donate | Mods | Minetest Modding Book

Hello profile reader

Emon
Member
Posts: 48
Joined: Tue Apr 26, 2016 09:35

Re: [Mod] Internationalization Library [0.1.0] [intllib]

by Emon » Post

List of mods using Intllib

The call has been made, will you join us to conquer the world? ;)

Kaeza, thanks for this mod!

User avatar
Wuzzy
Member
Posts: 4804
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy
Contact:

Re: [Mod] Internationalization Library [0.1.0] [intllib]

by Wuzzy » Post

Hey, I have problem with whitespace.

I want to add a string with trailing space or leading space but I can't translate it. The mod documentation claims I can declare space with the special character “\s” but it doesn't seem to work. Here's a minimal example:

Code: Select all

local S
if (minetest.get_modpath("intllib")) then
	dofile(minetest.get_modpath("intllib").."/intllib.lua")
	S = intllib.Getter(minetest.get_current_modname())
else
	S = function ( s ) return s end
end

minetest.register_craftitem("spacetest:lead", {
	description = S(" Space")
})

minetest.register_craftitem("spacetest:trail", {
	description = S("Space ")
})
And here's a translation file (locale/de.txt):

Code: Select all

\sSpace = \sLeer
Space\s = Leer\s
Sadly, intllib does NOT translate the item names. What is wrong? (Btw, I downloaded new intllib version just today.)

PS: Not really wanting to rush you, but is there any chance there will be another official intllib release after only 3 years? :P


PPS:
kaeza wrote: Dependencies: default
Huh?

Xanthin
Member
Posts: 126
Joined: Fri Mar 07, 2014 14:05
GitHub: Xanthin
IRC: Xanthin
In-game: Xanthin
Location: Germany

Re: [Mod] Internationalization Library [0.1.0] [intllib]

by Xanthin » Post

I hope I understand you correct, Wuzzy.

Code: Select all

\ \Space = \ \Leer
Space\ \ = Leer\ \
That's what I use in those situations.

User avatar
Wuzzy
Member
Posts: 4804
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy
Contact:

Re: [Mod] Internationalization Library [0.1.0] [intllib]

by Wuzzy » Post

Xanthin, it worked.
WTF, why? It shouldn't work, this is totally not what the documentation said. This seems to be a bug in the mod.
The documentation says I must use “/s”. ]:-(
But thanks for your solution.

But why the backslashes before “L” and “S”?

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:

Re: [Mod] Internationalization Library [0.1.0] [intllib]

by kaeza » Post

Wuzzy wrote:this is totally not what the documentation said. This seems to be a bug in the mod.
The documentation says I must use “/s”.
It's not a bug... it's a feature!

Sorry, will fix it Real Soon™.
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
Wuzzy
Member
Posts: 4804
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy
Contact:

Re: [Mod] Internationalization Library [0.1.0] [intllib]

by Wuzzy » Post

Thanks for fixing /s in the meanwhile, even if you don't talk much on these forums. :D

Can you please take the current version of intllib and just call it “version 0.2.0”? People on these forums will tend to think this mod is dead since the version number is stuck on 0.1.0 for so long (it took me long for ME to realize this mod is actually NOT dead). It doesn't need to be perfect, just give players out there a signal that this mod is still alive. ;-)
Alternatively, if you are lazy, you could rename the thread to “[Mod] Internationalization Library [Git] [intllib]” if you don't feel like making official releases at all (You link to HEAD, after all, and not a particular revision). This is less work for you, but on the downside, users never really know when there are updates.

Please add the usual metadata files (description.txt, mod.conf; see lua_api.txt for more info).

Also, please remove the “dependency: default” nonsense from the first post. This is clearly incorrect. Your mod has actually no dependencies (I tested it by using it without Minetest Game / the default mod and it worked just fine).


EDIT:
Also, thanks for the work on this mod. In the past I have included intllib support for many of my mods. I am glad that this mod now includes a basic toolchain to extract and update the strings. This is very important IMO since manual string extraction is VERY tedious (and error-prone).
Intllib works well for singleplayer but users must be aware that this mod is not very well suited for servers. Server operators must be aware that using intllib forces the server langague on every client, e.g. if server is Spanish, ALL clients will receive Spanish messages.

Although I think the ultimate goal of Minetest should be to add native mod translation support, I think this mod is useful for the meantime for singleplayer use. Another reason why I include intllib support for my mods is that for the time when mod translation support finally arrives, I probably only have to change the boilerplate, but the texts are already translated. :-)

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:

Re: [Mod] Internationalization Library [intllib]

by kaeza » Post

Edited the post to address some of your points. Also added the metadata as requested. `lua_api.txt` was not of much help regarding `description.txt`, but found some help here. Tell me if something's wrong.

For some reason phpBB does not update the last edited date of posts when a moderator does it, and too lazy/uninterested to look for a way. I added a note to the first post to this effect.

I'm really glad people find this mod useful, and I should thank you and all the modders who provide support for `intllib` in their mods, and their respective translators, for making Minetest better.
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
Wuzzy
Member
Posts: 4804
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy
Contact:

Re: [Mod] Internationalization Library [intllib]

by Wuzzy » Post

Thank you. I think the description is OK. The description.txt is used by Minetest in the main menu, tab “Mods”. Yeah, description.txt is really that simple: Just a short text file containing a description of the mod. If it renders correctly in the main menu tab, then your description is probably OK. Rubenwardy's advice is unofficial as far I know.

This file is also used by other applications. For instance, Minetest Bower uses it to show the description in the search results.

User avatar
Wuzzy
Member
Posts: 4804
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy
Contact:

Re: [Mod] Internationalization Library [intllib]

by Wuzzy » Post

Sadly, this mod breaks when mod security is on. :-(

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:

Re: [Mod] Internationalization Library [intllib]

by kaeza » Post

Wuzzy wrote:Sadly, this mod breaks when mod security is on. :-(
Hm? I have mod security on and have no problems.

What's the error?
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

Post Reply

Who is online

Users browsing this forum: No registered users and 47 guests