1
0
Fork 0
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:
rubenwardy 2024-02-24 19:13:07 +00:00 committed by GitHub
parent 57de599a29
commit b4be483d3e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 252 additions and 47 deletions

View file

@ -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
-------