@@ -2199,6 +2199,15 @@ Two functions are provided to translate strings: `minetest.translate` and `minet
2199
2199
2200
2200
this will be displayed as "Laine Rouge" on clients with a French locale.
2201
2201
2202
+ ### Operations on translated strings
2203
+
2204
+ The output of `minetest.translate` is a string, with escape sequences adding additional information to that string
2205
+ so that it can be translated on the different clients. In particular, you can't expect operations like string.length
2206
+ to work on them like you would expect them to, or string.gsub to work in the expected manner. However, string
2207
+ concatenation will still work as expected (note that you should only use this for things like formspecs; do not
2208
+ translate sentences by breaking them into parts; arguments should be used instead), and operations such as
2209
+ `minetest.colorize` which are only concatenation under the hood as well.
2210
+
2202
2211
### Translation file format
2203
2212
A translation file has the suffix `.[lang].tr`, where `[lang]` is the language it corresponds to.
2204
2213
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 `@`.
2221
2230
files to avoid begin confused with the `=` separating the original from the translation.
2222
2231
* `@\n` (where the `\n` is a literal newline) acts as a literal newline. As with `@=`, this escape is not required
2223
2232
in strings given to `minetest.translate`, but is in translation files.
2233
+ * `@n` acts as a literal newline as well.
2224
2234
2225
2235
`minetest` namespace reference
2226
2236
------------------------------
0 commit comments