Make translatable

This commit is contained in:
Wuzzy 2019-03-07 18:43:04 +01:00
parent fe46c670e3
commit 39ce9a6585

View File

@ -1,5 +1,7 @@
select_item = {}
local S = minetest.get_translator("select_item")
-- Cache for result of item filters
local player_filters = {}
local player_filter_results = {}
@ -121,8 +123,8 @@ local show_dialog_page = function(playername, dialogname, filter, compare, page)
if #items == 0 then
local form = "size[6,2]"..
bg ..
"label[0,0;There are no items to choose from.]"..
"button_exit[0,1;2,1;cancel;OK]"
"label[0,0;"..minetest.formspec_escape(S("There are no items to choose from.")).."]"..
"button_exit[0,1;2,1;cancel;"..minetest.formspec_escape(S("There are no items to choose from.")).."]"
minetest.show_formspec(playername, "select_item:page1", form)
return #items
end
@ -132,7 +134,7 @@ local show_dialog_page = function(playername, dialogname, filter, compare, page)
if page == nil then page = 1 end
local start = 1 + (page-1) * xsize * ysize
player_maxpage[playername] = total_pages
form = form .. "label[0,0;Select an item:]"
form = form .. "label[0,0;"..minetest.formspec_escape(S("Select an item:")).."]"
for i=start, #items do
local itemstring = items[i].itemstring
local itemdef = items[i].itemdef
@ -155,9 +157,9 @@ local show_dialog_page = function(playername, dialogname, filter, compare, page)
if total_pages > 1 then
form = form .. "button[0,"..ynav..";1,1;previous;<]"
form = form .. "button[1,"..ynav..";1,1;next;>]"
form = form .. "label[2,"..ynav..";"..minetest.formspec_escape(string.format("Page %d/%d", page, total_pages)).."]"
form = form .. "label[2,"..ynav..";"..minetest.formspec_escape(S("Page @1/@2", page, total_pages)).."]"
end
form = form .. "button_exit["..(xsize-2)..","..ynav..";2,1;cancel;Cancel]"
form = form .. "button_exit["..(xsize-2)..","..ynav..";2,1;cancel;"..minetest.formspec_escape(S("Cancel")).."]"
minetest.show_formspec(playername, "select_item:page"..page.."%%"..dialogname, form)
return #items
end