mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-12 08:05:18 +02:00
Add support for translating content titles and descriptions (#12208)
This commit is contained in:
@@ -323,6 +323,7 @@ Package - content which is downloadable from the content db, may or may not be i
|
||||
description = "description",
|
||||
author = "author",
|
||||
path = "path/to/content",
|
||||
textdomain = "textdomain", -- textdomain to translate title / description with
|
||||
depends = {"mod", "names"}, -- mods only
|
||||
optional_depends = {"mod", "names"}, -- mods only
|
||||
}
|
||||
@@ -340,6 +341,13 @@ Package - content which is downloadable from the content db, may or may not be i
|
||||
error_message = "", -- message or nil
|
||||
}
|
||||
```
|
||||
* `core.get_content_translation(path, domain, string)`
|
||||
* Translates `string` using `domain` in content directory at `path`.
|
||||
* Textdomains will be found by looking through all locale folders.
|
||||
* String should contain translation markup from `core.translate(textdomain, ...)`.
|
||||
* Ex: `core.get_content_translation("mods/mymod", "mymod", core.translate("mymod", "Hello World"))`
|
||||
will translate "Hello World" into the current user's language
|
||||
using `mods/mymod/locale/mymod.fr.tr`.
|
||||
|
||||
Logging
|
||||
-------
|
||||
|
Reference in New Issue
Block a user