minetest-mods / craftguide

:book: The most comprehensive Crafting Guide on Minetest
Other
43 stars 20 forks source link

Add formspec escape, apply proper format strings #64

Closed Wuzzy2 closed 5 years ago

Wuzzy2 commented 5 years ago

This mod messed around with the formspec, adding variable strings into it without escaping them. This PR fixes this. As a general advice: Never trust strings that can change, so you have to be paranoid about them by sending them through minetest.formspec_escape.

It also applies format strings properly to strings that have to be translated. Please note: String concatenation is toxic for translators, because in other languages, the word order might be different. Always use format strings when you have to use parameters in translatable strings.

Thank you for your attention.

kilbith commented 5 years ago

mt.formspec_escape could be localized to fs_esc to reduce the lines length.

kilbith commented 5 years ago

Merged with modifs: https://github.com/minetest-mods/craftguide/commit/c4272d8d248769f1a8efe2d9a1077904eff64f13