Ensure formspec escaping for translated strings

This commit is contained in:
Wuzzy
2016-08-06 17:23:46 +02:00
parent 534c7bd92c
commit c816666945
6 changed files with 63 additions and 56 deletions

View File

@ -4,16 +4,17 @@
-- License: GPLv3
local S = unified_inventory.gettext
local F = unified_inventory.fgettext
unified_inventory.register_page("bags", {
get_formspec = function(player)
local player_name = player:get_player_name()
local formspec = "background[0.06,0.99;7.92,7.52;ui_bags_main_form.png]"
formspec = formspec.."label[0,0;"..S("Bags").."]"
formspec = formspec.."button[0,2;2,0.5;bag1;"..S("Bag 1").."]"
formspec = formspec.."button[2,2;2,0.5;bag2;"..S("Bag 2").."]"
formspec = formspec.."button[4,2;2,0.5;bag3;"..S("Bag 3").."]"
formspec = formspec.."button[6,2;2,0.5;bag4;"..S("Bag 4").."]"
formspec = formspec.."label[0,0;"..F("Bags").."]"
formspec = formspec.."button[0,2;2,0.5;bag1;"..F("Bag 1").."]"
formspec = formspec.."button[2,2;2,0.5;bag2;"..F("Bag 2").."]"
formspec = formspec.."button[4,2;2,0.5;bag3;"..F("Bag 3").."]"
formspec = formspec.."button[6,2;2,0.5;bag4;"..F("Bag 4").."]"
formspec = formspec.."listcolors[#00000000;#00000000]"
formspec = formspec.."list[detached:"..minetest.formspec_escape(player_name).."_bags;bag1;0.5,1;1,1;]"
formspec = formspec.."list[detached:"..minetest.formspec_escape(player_name).."_bags;bag2;2.5,1;1,1;]"
@ -36,7 +37,7 @@ unified_inventory.register_button("bags", {
local stack = player:get_inventory():get_stack("bag1", 1)
local image = stack:get_definition().inventory_image
local formspec = "image[7,0;1,1;"..image.."]"
formspec = formspec.."label[0,0;"..S("Bag 1").."]"
formspec = formspec.."label[0,0;"..F("Bag 1").."]"
formspec = formspec.."listcolors[#00000000;#00000000]"
formspec = formspec.."list[current_player;bag1contents;0,1;8,3;]"
formspec = formspec.."listring[current_name;bag1contents]"
@ -57,7 +58,7 @@ unified_inventory.register_button("bags", {
local stack = player:get_inventory():get_stack("bag2", 1)
local image = stack:get_definition().inventory_image
local formspec = "image[7,0;1,1;"..image.."]"
formspec = formspec.."label[0,0;"..S("Bag 2").."]"
formspec = formspec.."label[0,0;"..F("Bag 2").."]"
formspec = formspec.."listcolors[#00000000;#00000000]"
formspec = formspec.."list[current_player;bag2contents;0,1;8,3;]"
formspec = formspec.."listring[current_name;bag2contents]"
@ -78,7 +79,7 @@ unified_inventory.register_button("bags", {
local stack = player:get_inventory():get_stack("bag3", 1)
local image = stack:get_definition().inventory_image
local formspec = "image[7,0;1,1;"..image.."]"
formspec = formspec.."label[0,0;"..S("Bag 3").."]"
formspec = formspec.."label[0,0;"..F("Bag 3").."]"
formspec = formspec.."listcolors[#00000000;#00000000]"
formspec = formspec.."list[current_player;bag3contents;0,1;8,3;]"
formspec = formspec.."listring[current_name;bag3contents]"
@ -99,7 +100,7 @@ unified_inventory.register_button("bags", {
local stack = player:get_inventory():get_stack("bag4", 1)
local image = stack:get_definition().inventory_image
local formspec = "image[7,0;1,1;"..image.."]"
formspec = formspec.."label[0,0;"..S("Bag 4").."]"
formspec = formspec.."label[0,0;"..F("Bag 4").."]"
formspec = formspec.."listcolors[#00000000;#00000000]"
formspec = formspec.."list[current_player;bag4contents;0,1;8,3;]"
formspec = formspec.."listring[current_name;bag4contents]"