Page 1 of 3

[Mod] Internationalization Library [intllib]

PostPosted: Thu Feb 28, 2013 11:52
by kaeza
English | Español | Português

Internationalization Lib for Minetest



This mod is an attempt at providing internationalization support for mods (something Minetest currently lacks).

This is good for both players and developers alike.
As a player, you will be able to see textual content (like messages, infotexts, and item names) from mods supporting this library in your native language.
As a mod developer, you can potentially get more users, as it makes the items easily readable by non-english-speakers.

This enhances the minetest interface overall, as the entire interface is in a single language.

NOTE: Even though the last edited date at the bottom of this post says it was edited long ago, this mod is still active (commit log).

License: Unlicense

Dependencies: none

Download:


How do I use it?

Please see the README for instructions.

Random bits

  • Glory! (thanks!) has made a nice image (WTFPL) to show support for intllib:

    Image

    If you want to add it to your mod's topic, you can use this piece of BBcode to add an image linking back to this topic:

    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
    [url=https://forum.minetest.net/viewtopic.php?f=11&t=4929][img]http://i.imgur.com/1bjbxmD.png[/img][/url]

  • Emon and several other users (thanks!) are compiling a list of mods that support this library.

Thanks for reading up to this point.
--
Yours Truly,
Kaeza

PostPosted: Thu Feb 28, 2013 12:05
by Calinou
This is a good start; however, I think a "definite" way to do this should be available in the default game directly, so that we have a simple, unified and bug-free way to translate mods. Also it should be made easier to translate mods (should not require editing files, just creating new ones).

PostPosted: Thu Feb 28, 2013 12:25
by kaeza
Thanks Calinou. If this gets enough interest (an caters to all needs) I may try to make a pull request for this on minetest_game.
As for an easier eay to translate the mods, I don't quite follow.

PostPosted: Thu Feb 28, 2013 12:39
by Calinou
By adding files for translations instead of editing existing files, this makes sharing new translations much easier (no patching needed, just drop in the file in the mod's directory). A directory named "locale" containing files like "es.txt" could be used for that.

PostPosted: Thu Feb 28, 2013 14:33
by kaeza
This is exactly what the mod does.
The `template.txt' file is just so translators don't have to scourge the Lua files in order to find what needs to be translated.
You just copy template.txt to, for example, fr.txt, and translate the strings, possibly telling the mod developer to merge the changes to his repo so it's available to everyone.
Edit: I have Spanish translations ready for several mods (used by modified versions of the mods I have locally): moreores, gloopores, beds, bones, homedecor, armor, plus some of my own mods.

PostPosted: Sun Mar 03, 2013 16:53
by kaeza
*BUMP*

I'd like to read more comments on this.

Is it useful? (from the end user's perspective)
Is something not clear?
Any ideas for additions?

I'd really appreciate more feedback on this, so maybe we can see mods in our native languages in the near future.

PostPosted: Tue Mar 05, 2013 21:13
by kaeza
Well, this thing is starting to get supported by other mods.
Thanks to Calinou for providing support into his mods moreblocks, moreores, maptools, and stairsplus.
Thanks to VanessaE for allowing me to mess with her code to add support for it in homedecor.
I also provided Spanish translations for all of those mods.

PostPosted: Wed Mar 06, 2013 09:02
by Calinou
kaeza wrote:admintools


maptools, not admintools.

PostPosted: Wed Mar 06, 2013 10:55
by kaeza
Sorry :P
Post edited.
EDIT: Also, some bug fixes.

PostPosted: Wed Mar 06, 2013 12:46
by Mito551
if it's japanese, is it ja or jp?

PostPosted: Wed Mar 06, 2013 14:55
by kaeza
Mito551 wrote:if it's japanese, is it ja or jp?

According to the List of ISO 639-1 codes (aka Two-Letter Language Codes) article in Wikipedia, it should be 'ja'.

PostPosted: Wed Mar 06, 2013 16:13
by Mito551
kaeza wrote:
Mito551 wrote:if it's japanese, is it ja or jp?

According to the List of ISO 639-1 codes (aka Two-Letter Language Codes) article in Wikipedia, it should be 'ja'.


thanks. (iso-codes, wow)

PostPosted: Wed Mar 06, 2013 18:53
by kaeza
Mito551 wrote:
kaeza wrote:
Mito551 wrote:if it's japanese, is it ja or jp?

According to the List of ISO 639-1 codes (aka Two-Letter Language Codes) article in Wikipedia, it should be 'ja'.


thanks. (iso-codes, wow)

Yes. The thing is that I use the LANG environment variable to detect the user's language. This works ok on Linux because that variable is always defined. Unfortunately, you have to add it yourself under Windows.

In case you don't know how (and so other Windows users know it in case they decide to install this mod), this is done like this:
  • Open the Start Menu, and select Settings -> Control Panel.
  • Start the "System" applet.
  • Select "Advanced" tab, and click the "Environment Variables" button.
  • Under the "User" section, add a variable named 'LANG' with the ISO Language Code of your choice.
  • Keep clicking OK until all dialogs are closed.

Edit:
Of course, you can also add a `language=<code>' setting to your `minetest.conf'. This will override system language.

PostPosted: Wed Mar 06, 2013 19:17
by Mito551
kaeza wrote:
Mito551 wrote:
kaeza wrote:According to the List of ISO 639-1 codes (aka Two-Letter Language Codes) article in Wikipedia, it should be 'ja'.


thanks. (iso-codes, wow)

Yes. The thing is that I use the LANG environment variable to detect the user's language. This works ok on Linux because that variable is always defined. Unfortunately, you have to add it yourself under Windows.

In case you don't know how (and so other Windows users know it in case they decide to install this mod), this is done like this:
  • Open the Start Menu, and select Settings -> Control Panel.
  • Start the "System" applet.
  • Select "Advanced" tab, and click the "Environment Variables" button.
  • Under the "User" section, add a variable named 'LANG' with the ISO Language Code of your choice.
  • Keep clicking OK until all dialogs are closed.

Edit:
Of course, you can also add a `language=<code>' setting to your `minetest.conf'. This will override system language.


hey, that's great! but ubfortunately, i can't test it. i don't know how to make japanese fonts work in minetest :(
do you know? can you tell me?

PostPosted: Wed Mar 06, 2013 23:11
by kaeza
Minetest supports TTF fonts. Just use a font that contains jap characters. Dunno if the current font supports it.

Edit:
The default font does not support those characters.
xyz on IRC suggested using this font: http://detours.googlecode.com/files/uming.ttf

PostPosted: Thu Mar 07, 2013 03:58
by Mito551
kaeza wrote:Minetest supports TTF fonts. Just use a font that contains jap characters. Dunno if the current font supports it.

Edit:
The default font does not support those characters.
xyz on IRC suggested using this font: http://detours.googlecode.com/files/uming.ttf


i mean, what do i do with it? i already asked xyz, but he didn't give proper answer. can you? sorry for bothering...

PostPosted: Thu Mar 07, 2013 07:33
by kaeza
Ah sorry.
Put it in any folder that is easily accessible, and change your minetest.conf, adding the following line:
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
font_path = path/to/uming.ttf

And no need to be sorry; you are not bothering at all :)
If anybodyshould be sorry, it should be me for bugging you to do this.
So... sowwy :)

PostPosted: Thu Mar 07, 2013 13:36
by Mito551
kaeza wrote:Ah sorry.
Put it in any folder that is easily accessible, and change your minetest.conf, adding the following line:
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
font_path = path/to/uming.ttf

And no need to be sorry; you are not bothering at all :)
If anybodyshould be sorry, it should be me for bugging you to do this.
So... sowwy :)

thank you very much :)
it doesn't work. probably because of the font itself, so i'll be fixing this.
UPD: no, tried other fonts, doesn't work. the font just becomes very small and unusable
it is either so(no font_path in conf):
http://screenshot.su/show.php?img=fdff5dd2026eb8ac7ba2b17a42e5978b.jpg
or (with this parameter) so:
http://screenshot.su/show.php?img=eb2ddac8dd0fb8989332484a422b6ef6.jpg

PostPosted: Thu Mar 07, 2013 16:14
by xyz
Check your paths, it works fine for me.
Image
UPD on Windows you probably want to use \ instead of /

PostPosted: Thu Mar 07, 2013 16:18
by Likwid H-Craft
Hey xyz can I use halo font?

PostPosted: Thu Mar 07, 2013 16:51
by Mito551
xyz wrote:Check your paths, it works fine for me.
Image
UPD on Windows you probably want to use \ instead of /


is it linux? i tried \ and / both. doesn't work.

PostPosted: Thu Mar 07, 2013 18:11
by xyz
Mito551 wrote:is it linux? i tried \ and / both. doesn't work.

Try to revert all changes in minetest.conf and then replace fonts/liberationsans.ttf with uming.ttc (or some other font)

PostPosted: Thu Mar 07, 2013 21:27
by Mito551
xyz wrote:
Mito551 wrote:is it linux? i tried \ and / both. doesn't work.

Try to revert all changes in minetest.conf and then replace fonts/liberationsans.ttf with uming.ttc (or some other font)


that worked. at least something now :D. thank you very much

PostPosted: Fri Mar 08, 2013 01:36
by prestidigitator
kaeza wrote:The thing is that I use the LANG environment variable to detect the user's language. This works ok on Linux because that variable is always defined. Unfortunately, you have to add it yourself under Windows.

There's a tiny, tiny bit of locale support built into the Lua standard libraries. I'm not SURE it will help, but it might be worth a try. You can get and set a locale for a category of formats, and I believe the string formatting and regex-like patterns make use of them. I'm not sure whether they are intended for full i18n or just formatting, and I don't know if they do any kind of automatic querying of the environment or if the APIs are just there so you can call them and explicitly set locales yourself.

PostPosted: Fri Mar 08, 2013 16:01
by PilzAdam
The mod/library uses the locale of the server and not the one of the client.

PostPosted: Wed Apr 09, 2014 23:09
by Xanthin
kaeza wrote:*BUMP*

I'd like to read more comments on this.

Is it useful? (from the end user's perspective)
Is something not clear?
Any ideas for additions?

I'd really appreciate more feedback on this, so maybe we can see mods in our native languages in the near future.


Hi kaeza,

the whole last month I used your mod to translate some mods for my daughter and her friends to play minetest in german language. It works very good and overall it is easy to use, for a noob like me without any experience in programming. There were some difficult situations witch bothered (?) me more than a day when it comes to code like print sth., chat messages, labels, infotext etc. But with a look at the already translated mods and some trying and experimenting (I can´t start the game anymore without a bumping heart fearing the next error message :D) it works. And afterall it was an interesting experience how the game works behind the screen (not meaning I understood much of that). At this point, thank you.

So here is a list of mods wich I know are translated and "supported" (means you can download the mod as usual and there is the locale directory with template.txt and intllib support) and the mods I translated but are not (yet) supported. These mods are available in my github account (translation branch), but could be outdated while the mod owner updated the mod and I didn´t notice it.

[spoiler]
supported mods:
food
gloopblocks
glow
hardenedclay
homedecor_modpack
moreblocks
moreores
moretrees
morestairs
plantlife
streets
technic
unifieddyes

unsupported mods:
minetest_game/mods (from stable branch 0.4.9)
  • bones
    bucket
    creative
    default
    doors
    dye
    farming
    fire
    flowers
    give_initial_stuff
    legacy
    screwdriver
    stairs
    vessels
    wool
animals_modpack
beds
bees
boats
campfire
candle (currently without the textures cause I can only use github in the browser and can´t upload images/sounds)
castle+
random_buildings/cottages
doors
dryplants
farming_plus
firestone
fishing
inbox
gemalde
lavalamp
lrfurn
memorandum
minetest-3d_armor]
mobfcooking
pyramids
stoneage
unified_inventory
u_skins
[/spoiler]

Greetings
Xanthin

PostPosted: Thu Apr 10, 2014 06:36
by mimilus
Xanthin Let me finish to play with my castle fork and after we look for the translation

All time I make modification in lua files, rename, cut so not already the time for translated it

But that's cool, When i'll finish things a want to do i'll push your translation

After I'll use it for french transltion too

PostPosted: Thu Apr 10, 2014 09:14
by 4aiman
Any chance of supporting languages with more that 2 forms of a noun and an adjective?
English uses isolated words. The only "thing" is "s" affix which shows us 3rd person single and " 's " which shows us "possesiveness".
Currently it's impossible to use proper Russian (just an example, any flective language fits here) to translate mods with this mod, because of the structure of the language itself.

Great mod anyway :) Just not for all.

PostPosted: Thu Apr 10, 2014 11:51
by Xanthin
mimilus wrote:Xanthin Let me finish to play with my castle fork and after we look for the translation
All time I make modification in lua files, rename, cut so not already the time for translated it

But that's cool, When i'll finish things a want to do i'll push your translation

After I'll use it for french transltion too


I guessed as much. ;) I try to stay up to date with your work (not difficult, I like to test your new features).

4aiman wrote:Any chance of supporting languages with more that 2 forms of a noun and an adjective?
English uses isolated words. The only "thing" is "s" affix which shows us 3rd person single and " 's " which shows us "possesiveness".
Currently it's impossible to use proper Russian (just an example, any flective language fits here) to translate mods with this mod, because of the structure of the language itself.

Great mod anyway :) Just not for all.


4aiman, please excuse my inquiry, I hardly try to understand what you mean.
As I know you could write every thing behind the "=" like :
Sandras red hair = Sandra has damn red hair because she eats so much carrots. :)

Ah, or do you mean things like that: %s's red hair = %ss red hair? In some cases this is also bad for proper german. Than I tried to give up the ease of this and made a longer column of all possible words like:
Sandra's red hair = Sandras red hair
Alex's red hair = Alex' red hair, (in german it´s only apostrophe)

Did I understand you correctly? Or did you have an example?

The only disadvantage I see is the limitation to latin characters. In german I can help me to rewrite umlauts (ä = ae) but I don´t know how you can make this with russian letters.

PostPosted: Thu Apr 10, 2014 12:57
by BrunoMine
I found a very complicated explanation. Explain to me in parts. Please!