diff options
author | Nathanaƫl Courant <Ekdohibs@users.noreply.github.com> | 2017-08-26 09:43:08 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-26 09:43:08 +0200 |
commit | 5a6618cc57097e1e7205ad6b1d967a3ad79d016e (patch) | |
tree | b44ba4000a020d4183a2599cc717cf2e1ce49c1e /doc | |
parent | fc13c00ef3e9b6f280146f3d77b6659fcc55a13c (diff) | |
download | minetest-5a6618cc57097e1e7205ad6b1d967a3ad79d016e.tar.gz minetest-5a6618cc57097e1e7205ad6b1d967a3ad79d016e.tar.bz2 minetest-5a6618cc57097e1e7205ad6b1d967a3ad79d016e.zip |
Add '@n' escape sequences and some documentation on translated strings.
Diffstat (limited to 'doc')
-rw-r--r-- | doc/lua_api.txt | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/doc/lua_api.txt b/doc/lua_api.txt index 6ff9c9433..152da5985 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -2199,6 +2199,15 @@ Two functions are provided to translate strings: `minetest.translate` and `minet this will be displayed as "Laine Rouge" on clients with a French locale. +### Operations on translated strings + +The output of `minetest.translate` is a string, with escape sequences adding additional information to that string +so that it can be translated on the different clients. In particular, you can't expect operations like string.length +to work on them like you would expect them to, or string.gsub to work in the expected manner. However, string +concatenation will still work as expected (note that you should only use this for things like formspecs; do not +translate sentences by breaking them into parts; arguments should be used instead), and operations such as +`minetest.colorize` which are only concatenation under the hood as well. + ### Translation file format A translation file has the suffix `.[lang].tr`, where `[lang]` is the language it corresponds to. The file should be a text file, with the following format: @@ -2221,6 +2230,7 @@ Strings that need to be translated can contain several escapes, preceded by `@`. files to avoid begin confused with the `=` separating the original from the translation. * `@\n` (where the `\n` is a literal newline) acts as a literal newline. As with `@=`, this escape is not required in strings given to `minetest.translate`, but is in translation files. +* `@n` acts as a literal newline as well. `minetest` namespace reference ------------------------------ |