mirror of
https://github.com/mt-mods/mail.git
synced 2025-08-23 08:17:24 -04:00
Fix strings (translations and checks)
This commit is contained in:
parent
720029a73e
commit
95ab299016
9 changed files with 180 additions and 114 deletions
16
ui/about.lua
16
ui/about.lua
|
@ -9,19 +9,19 @@ function mail.show_about(name)
|
|||
tabheader[0.3,1;optionstab;]] .. S("Settings") .. "," .. S("About") .. [[;2;false;false]
|
||||
button[9.35,0;0.75,0.5;back;X]
|
||||
label[0,0.8;Mail]
|
||||
label[0,1.2;Provided my mt-mods]
|
||||
label[0,1.6;Version: 1.2.0-dev]
|
||||
label[0,2.2;Licenses:]
|
||||
label[0.2,2.6;Expat (code), WTFPL (textures)]
|
||||
label[0,1.2;]] .. S("Provided my mt-mods") .. [[]
|
||||
label[0,1.6;]] .. S("Version") .. [[ : 1.2.0-dev]
|
||||
label[0,2.2;]] .. S("Licenses") .. [[ :]
|
||||
label[0.2,2.6;]] .. S("Expat (code), WTFPL (textures)") .. [[]
|
||||
label[0,3.2;https://github.com/mt-mods/mail]
|
||||
label[0,3.6;https://content.minetest.net/packages/mt-mods/mail]
|
||||
textarea[0.5,4.8;4,5.5;;Note;]] ..
|
||||
[[NOTE: Communication using this system is NOT guaranteed to be private!]] ..
|
||||
[[ Admins are able to view the messages of any player.]
|
||||
textarea[0.5,4.8;4,5.5;;]] .. S("Note") .. [[;]] ..
|
||||
S("Communication using this system is NOT guaranteed to be private!") .. " " ..
|
||||
S("Admins are able to view the messages of any player.") .. [[]
|
||||
|
||||
tablecolumns[color;text;text]
|
||||
table[5,0.75;4.9,5.5;contributors;]] ..
|
||||
[[#999,Contributors,,]] ..
|
||||
[[#999,]] .. S("Contributors") .. [[,,]] ..
|
||||
[[#FFD700,Cheapie,Initial idea/project,]] ..
|
||||
[[#FFF,Rubenwardy,Lua/UI improvements,]] ..
|
||||
[[#FFF,BuckarooBanzay,Clean-ups\, Refactoring,]] ..
|
||||
|
|
|
@ -29,7 +29,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
|||
local evt = minetest.explode_table_event(fields.contacts)
|
||||
for k, _, i in mail.pairsByKeys(contacts) do
|
||||
if i == evt.row - 1 then
|
||||
mail.selected_idxs.contacts[name] = k
|
||||
mail.selected_idxs.contacts[name] = tonumber(k)
|
||||
break
|
||||
end
|
||||
end
|
||||
|
@ -60,14 +60,14 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
|||
local last = nil
|
||||
for k in mail.pairsByKeys(contacts) do
|
||||
if found then
|
||||
mail.selected_idxs.contacts[name] = k
|
||||
mail.selected_idxs.contacts[name] = tonumber(k)
|
||||
break
|
||||
elseif k == mail.selected_idxs.contacts[name] then
|
||||
mail.delete_contact(name, contacts[mail.selected_idxs.contacts[name]].name)
|
||||
mail.selected_idxs.contacts[name] = nil
|
||||
found = true
|
||||
else
|
||||
last = k
|
||||
last = tonumber(k)
|
||||
end
|
||||
end
|
||||
if found and not mail.selected_idxs.contacts[name] then
|
||||
|
|
|
@ -13,15 +13,13 @@ function mail.show_edit_contact(name, contact_name, note, illegal_name_hint)
|
|||
]]
|
||||
if illegal_name_hint == "collision" then
|
||||
formspec = formspec .. [[
|
||||
label[4,1;]] .. S("That name") .. [[]
|
||||
label[4,1.5;]] .. S("is already in") .. [[]
|
||||
label[4,2;]] .. S("your contacts.") .. [[]
|
||||
textarea[4.25,1;2.5,6;;;]] ..
|
||||
S("That name is already in your contacts") .. [[]
|
||||
]]
|
||||
elseif illegal_name_hint == "empty" then
|
||||
formspec = formspec .. [[
|
||||
label[4,1;]] .. S("The contact") .. [[]
|
||||
label[4,1.5;]] .. S("name cannot") .. [[]
|
||||
label[4,2;]] .. S("be empty.") .. [[]
|
||||
textarea[4.25,1;2.5,6;;;]] ..
|
||||
S("The contact name cannot be empty.") .. [[]
|
||||
]]
|
||||
end
|
||||
formspec = formspec .. mail.theme
|
||||
|
@ -40,19 +38,21 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
|||
local contacts = mail.get_contacts(name)
|
||||
|
||||
if fields.save then
|
||||
if mail.selected_idxs.contacts[name] and mail.selected_idxs.contacts[name] ~= "#NEW#" then
|
||||
local contact = contacts[mail.selected_idxs.contacts[name]]
|
||||
if mail.selected_idxs.contacts[name] ~= string.lower(fields.name) then
|
||||
if mail.selected_idxs.contacts[name] then
|
||||
local contact = contacts[mail.selected_idxs.contacts[name]] or {name = ""}
|
||||
if contact.name ~= fields.name or fields.name == "" then
|
||||
-- name changed!
|
||||
if #fields.name == 0 then
|
||||
mail.show_edit_contact(name, contact.name, fields.note, "empty")
|
||||
return true
|
||||
|
||||
elseif contacts[string.lower(fields.name)] ~= nil then
|
||||
elseif mail.get_contact(name, fields.name) then
|
||||
mail.show_edit_contact(name, contact.name, fields.note, "collision")
|
||||
return true
|
||||
|
||||
else
|
||||
contact.name = fields.name
|
||||
contact.note = fields.note
|
||||
mail.update_contact(name, contact)
|
||||
contacts[mail.selected_idxs.contacts[name]] = nil
|
||||
end
|
||||
|
|
|
@ -16,15 +16,13 @@ function mail.show_edit_maillist(playername, maillist_name, desc, players, illeg
|
|||
]]
|
||||
if illegal_name_hint == "collision" then
|
||||
formspec = formspec .. [[
|
||||
label[4,1;]] .. S("That name") .. [[]
|
||||
label[4,1.5;]] .. S("is already in") .. [[]
|
||||
label[4,2;]] .. S("your maillists.") .. [[]
|
||||
textarea[4.25,1;2.5,6;;;]] ..
|
||||
S("That name is already in your mailing lists.") .. [[]
|
||||
]]
|
||||
elseif illegal_name_hint == "empty" then
|
||||
formspec = formspec .. [[
|
||||
label[4,1;]] .. S("The maillist") .. [[]
|
||||
label[4,1.5;]] .. S("name cannot") .. [[]
|
||||
label[4,2;]] .. S("be empty.") .. [[]
|
||||
textarea[4.25,1;2.5,6;;;]] ..
|
||||
S("The mailing list name cannot be empty.") .. [[]
|
||||
]]
|
||||
end
|
||||
formspec = formspec .. mail.theme
|
||||
|
@ -41,13 +39,46 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
|||
end
|
||||
|
||||
local name = player:get_player_name()
|
||||
local maillists = mail.get_maillists(name)
|
||||
|
||||
if fields.save then
|
||||
mail.update_maillist(name, {
|
||||
owner = name,
|
||||
name = fields.name,
|
||||
desc = fields.desc,
|
||||
players = mail.parse_player_list(fields.players)
|
||||
}, old_lists_names[name])
|
||||
if mail.selected_idxs.maillists[name] then
|
||||
local maillist = maillists[mail.selected_idxs.maillists[name]] or {name = ""}
|
||||
if maillist.name ~= fields.name or fields.name == "" then
|
||||
-- name changed!
|
||||
if #fields.name == 0 then
|
||||
mail.show_edit_maillist(name, maillist.name, fields.desc, fields.players, "empty")
|
||||
return true
|
||||
|
||||
elseif mail.get_maillist_by_name(name, fields.name) then
|
||||
mail.show_edit_maillist(name, maillist.name, fields.desc, fields.players, "collision")
|
||||
return true
|
||||
|
||||
else
|
||||
mail.update_maillist(name, {
|
||||
owner = name,
|
||||
name = fields.name,
|
||||
desc = fields.desc,
|
||||
players = mail.parse_player_list(fields.players)
|
||||
}, old_lists_names[name])
|
||||
maillists[mail.selected_idxs.maillists[name]] = nil
|
||||
end
|
||||
else
|
||||
mail.update_maillist(name, {
|
||||
owner = name,
|
||||
name = fields.name,
|
||||
desc = fields.desc,
|
||||
players = mail.parse_player_list(fields.players)
|
||||
}, old_lists_names[name])
|
||||
end
|
||||
else
|
||||
mail.update_maillist(name, {
|
||||
owner = name,
|
||||
name = fields.name,
|
||||
desc = fields.desc,
|
||||
players = mail.parse_player_list(fields.players)
|
||||
}, old_lists_names[name])
|
||||
end
|
||||
mail.show_maillists(name)
|
||||
|
||||
elseif fields.back then
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue