mirror of
https://github.com/luanti-org/luanti.git
synced 2025-09-15 18:57:08 +00:00
Add support for translating content titles and descriptions (#12208)
This commit is contained in:
parent
57de599a29
commit
b4be483d3e
12 changed files with 252 additions and 47 deletions
|
@ -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
|
||||
-------
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue