mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Add server side translations capability (#9733)
* Add server side translations capability
This commit is contained in:
parent
914dbeaa0b
commit
cee3c5e73d
14 changed files with 126 additions and 18 deletions
|
@ -3176,8 +3176,22 @@ Strings that need to be translated can contain several escapes, preceded by `@`.
|
|||
`minetest.translate`, but is in translation files.
|
||||
* `@n` acts as a literal newline as well.
|
||||
|
||||
Server side translations
|
||||
------------------------
|
||||
|
||||
On some specific cases, server translation could be useful. For example, filter
|
||||
a list on labels and send results to client. A method is supplied to achieve
|
||||
that:
|
||||
|
||||
`minetest.get_translated_string(lang_code, string)`: Translates `string` using
|
||||
translations for `lang_code` language. It gives the same result as if the string
|
||||
was translated by the client.
|
||||
|
||||
The `lang_code` to use for a given player can be retrieved from
|
||||
the table returned by `minetest.get_player_information(name)`.
|
||||
|
||||
IMPORTANT: This functionality should only be used for sorting, filtering or similar purposes.
|
||||
You do not need to use this to get translated strings to show up on the client.
|
||||
|
||||
Perlin noise
|
||||
============
|
||||
|
@ -4153,6 +4167,7 @@ Utilities
|
|||
connection_uptime = 200, -- seconds since client connected
|
||||
protocol_version = 32, -- protocol version used by client
|
||||
formspec_version = 2, -- supported formspec version
|
||||
lang_code = "fr" -- Language code used for translation
|
||||
-- following information is available on debug build only!!!
|
||||
-- DO NOT USE IN MODS
|
||||
--ser_vers = 26, -- serialization version used by client
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue