Document translation in presets
This commit is contained in:
parent
95efe81a8d
commit
57e2520b35
@ -30,12 +30,19 @@ As the sender you can also select from preset formspecs.
|
||||
- In `settingtypes.txt` you can set the priv needed to allow players to send out chat_formspecs.
|
||||
- you can modify `chat_formspec.preset` from another mod. This is a table indexed by name, with a easy Syntax String as value.
|
||||
**you must call `chat_formspec.update()` afterwards**
|
||||
- You can use translated text in the presets too. make sure that the translation is not splitted by #'s. **The text will already appear translated in the senders formspec so he will see the translation based on his locale**
|
||||
|
||||
### Example
|
||||
```lua
|
||||
chat_formspec.preset = {} -- delete all presets defined so far
|
||||
chat_formspec.preset.Question = "What is the answer#42"
|
||||
chat_formspec.preset.tell_me = "Tell me something#"
|
||||
|
||||
-- translation example
|
||||
local S = minetest.get_translator("mymod")
|
||||
chat_formspec.preset.translation = S("Can you read this") .. "#"
|
||||
.. S("Yes") .. "#" .. S("No")
|
||||
|
||||
chat_formspec.update()
|
||||
````
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user