summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorEvidenceB Kidscode <49488517+EvidenceBKidscode@users.noreply.github.com>2020-04-25 07:20:00 +0200
committerGitHub <noreply@github.com>2020-04-25 07:20:00 +0200
commitcee3c5e73d7af2a876aa76275234ee76e7cb1bbc (patch)
tree66abf52902be5c4d7ccc7aa40d20ed77a2a263e0 /doc
parent914dbeaa0be4b5ef87506b605ef4e241cd3732dc (diff)
downloadminetest-cee3c5e73d7af2a876aa76275234ee76e7cb1bbc.tar.gz
minetest-cee3c5e73d7af2a876aa76275234ee76e7cb1bbc.tar.bz2
minetest-cee3c5e73d7af2a876aa76275234ee76e7cb1bbc.zip
Add server side translations capability (#9733)
* Add server side translations capability
Diffstat (limited to 'doc')
-rw-r--r--doc/lua_api.txt15
1 files changed, 15 insertions, 0 deletions
diff --git a/doc/lua_api.txt b/doc/lua_api.txt
index 77f06682f..3ca32649a 100644
--- a/doc/lua_api.txt
+++ b/doc/lua_api.txt
@@ -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