Translating mods

Post Reply
MHL
Member
Posts: 405
Joined: Mon Aug 20, 2018 00:44
GitHub: NOT APPLICABLE
IRC: MCL
In-game: singleplayer
Location: Somewhere in SSWZ
Contact:

Translating mods

by MHL » Post

The changelog says that mods can be now translated?
How do you do that?
COME SEE MY MINETEST MAP!!! FRANCAIS TRADDUCCIONS COMING SOON! ČESKY PŘEKLAD JIŽ NEDLOUHO!!!

User avatar
Linuxdirk
Member
Posts: 2713
Joined: Wed Sep 17, 2014 11:21
In-game: Linuxdirk
Location: Germany
Contact:

Re: Translating mods

by Linuxdirk » Post

You need to change how your strings are set in your mods and you need a new file in a new folder.

Code: Select all

local S = minetest.get_translator('modname')
local foo = S('My translated string')
File ./locale/modname.de.tr (syntax: textdomain.language.tr, it is advised to simply use the mod name as textdomain to avoid naming conflicts):

Code: Select all

# textdomain: modname
My translated string=Meine übersetzte Zeichenkette
You can also use variables named @1 to @9 being positional arguments.

Code: Select all

local foo = S('This is important: @1, this too: @2', super_important_variable, second_important_thing)
You can't skip a variable. In your translation file it's the same.

Code: Select all

# textdomain: modname
My translated string=Meine übersetzte Zeichenkette
This is important: @1, this too: @2=Dies ist wichtig: @1, dies auch: @2
See here for full documentation:

https://github.com/minetest/minetest/bl ... 2455-L2549

Since the system ignores empty lines and all lines not being original string=translated string or lines starting with # textdomain: you can also comment and group your translations.

https://gitlab.com/4w/mtimer/raw/4f8009 ... imer.de.tr

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests