Improve strings and make them translatable

This commit is contained in:
Wuzzy
2016-08-30 11:31:16 +02:00
committed by rubenwardy
parent 50349917e5
commit 67946bf0c4
6 changed files with 234 additions and 97 deletions

23
api.lua
View File

@ -327,21 +327,23 @@ function awards.getFormspec(name, to, sid)
local item = listofawards[sid+0]
local def = awards.def[item.name]
if def and def.secret and not item.got then
formspec = formspec .. "label[1,2.75;(Secret Award)]"..
formspec = formspec .. "label[1,2.75;"..minetest.formspec_escape(S("(Secret Award)")).."]"..
"image[1,0;3,3;awards_unknown.png]"
if def and def.description then
formspec = formspec .. "label[0,3.25;Unlock this award to find out what it is.]"
formspec = formspec .. "label[0,3.25;"..minetest.formspec_escape(S("Unlock this award to find out what it is.")).."]"
end
else
local title = item.name
if def and def.title then
title = def.title
end
local status = ""
local status = "%s"
if item.got then
status = " (got)"
status = S("%s (got)")
end
formspec = formspec .. "label[1,2.75;" .. title .. status .. "]"
formspec = formspec .. "label[1,2.75;" ..
string.format(status, minetest.formspec_escape(title)) ..
"]"
if def and def.icon then
formspec = formspec .. "image[1,0;3,3;" .. def.icon .. "]"
end
@ -381,7 +383,7 @@ function awards.getFormspec(name, to, sid)
first = false
if def.secret and not award.got then
formspec = formspec .. "#707070(Secret Award)"
formspec = formspec .. "#707070"..minetest.formspec_escape(S("(Secret Award)"))
else
local title = award.name
if def and def.title then
@ -403,23 +405,22 @@ function awards.show_to(name, to, sid, text)
name = to
end
if name == to and awards.player(to).disabled then
minetest.chat_send_player("You've disabled awards. Type /awards" ..
" enable to reenable")
minetest.chat_send_player(S("You've disabled awards. Type /awards enable to reenable."))
return
end
if text then
if not awards.players[name] or not awards.players[name].unlocked then
minetest.chat_send_player(to, "You have not unlocked any awards")
minetest.chat_send_player(to, S("You have not unlocked any awards"))
return
end
minetest.chat_send_player(to, name.."'s awards:")
minetest.chat_send_player(to, string.format(S("%ss awards:"), name))
for _, str in pairs(awards.players[name].unlocked) do
local def = awards.def[str]
if def then
if def.title then
if def.description then
minetest.chat_send_player(to, def.title..": "..def.description)
minetest.chat_send_player(to, string.format(S("%s: %s"), def.title, def.description))
else
minetest.chat_send_player(to, def.title)
end