mirror of
https://gitlab.com/rubenwardy/awards.git
synced 2024-12-28 03:30:40 +01:00
Improve strings and make them translatable
This commit is contained in:
parent
50349917e5
commit
67946bf0c4
23
api.lua
23
api.lua
@ -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("%s’s 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
|
||||
|
@ -14,20 +14,28 @@
|
||||
-- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
--
|
||||
|
||||
local S
|
||||
if (intllib) then
|
||||
dofile(minetest.get_modpath("intllib").."/intllib.lua")
|
||||
S = intllib.Getter(minetest.get_current_modname())
|
||||
else
|
||||
S = function ( s ) return s end
|
||||
end
|
||||
|
||||
minetest.register_chatcommand("awards", {
|
||||
params = "",
|
||||
description = "awards: list awards",
|
||||
params = S("[c|clear|disable|enable]"),
|
||||
description = S("Show, clear, disable or enable your achievements"),
|
||||
func = function(name, param)
|
||||
if param == "clear" then
|
||||
awards.clear_player(name)
|
||||
minetest.chat_send_player(name, "All your awards and statistics " ..
|
||||
" have been cleared. You can now start again.")
|
||||
minetest.chat_send_player(name,
|
||||
S("All your awards and statistics have been cleared. You can now start again."))
|
||||
elseif param == "disable" then
|
||||
awards.disable(name)
|
||||
minetest.chat_send_player(name, "You have disabled awards. (only affects you)")
|
||||
minetest.chat_send_player(name, S("You have disabled your achievements."))
|
||||
elseif param == "enable" then
|
||||
awards.enable(name)
|
||||
minetest.chat_send_player(name, "You have enabled awards. (only affects you)")
|
||||
minetest.chat_send_player(name, S("You have enabled your achievements."))
|
||||
elseif param == "c" then
|
||||
awards.show_to(name, name, nil, true)
|
||||
else
|
||||
@ -37,14 +45,14 @@ minetest.register_chatcommand("awards", {
|
||||
})
|
||||
|
||||
minetest.register_chatcommand("awd", {
|
||||
params = "award name",
|
||||
description = "awd: Details of awd gotten",
|
||||
params = S("<achievement ID>"),
|
||||
description = S("Show details of an achievement"),
|
||||
func = function(name, param)
|
||||
local def = awards.def[param]
|
||||
if def then
|
||||
minetest.chat_send_player(name,def.title..": "..def.description)
|
||||
minetest.chat_send_player(name, string.format(S("%s: %s"), def.title, def.description))
|
||||
else
|
||||
minetest.chat_send_player(name,"Award not found.")
|
||||
minetest.chat_send_player(name, S("Achievement not found."))
|
||||
end
|
||||
end
|
||||
})
|
||||
@ -53,7 +61,8 @@ minetest.register_chatcommand("awpl", {
|
||||
privs = {
|
||||
server = true
|
||||
},
|
||||
description = "awpl: Get the statistics for the player given",
|
||||
params = S("<name>"),
|
||||
description = S("Get the achievements statistics for the given player or yourself"),
|
||||
func = function(name, param)
|
||||
if not param or param == "" then
|
||||
param = name
|
||||
|
6
init.lua
6
init.lua
@ -166,7 +166,7 @@ awards.register_achievement("awards_stonebrick2", {
|
||||
|
||||
awards.register_achievement("awards_stonebrick3", {
|
||||
title = S("Fortress"),
|
||||
description = S("Craft 3200 stone bricks."),
|
||||
description = S("Craft 3,200 stone bricks."),
|
||||
icon = "default_stone_brick.png^awards_level3.png",
|
||||
trigger = {
|
||||
type = "craft",
|
||||
@ -299,7 +299,7 @@ awards.register_achievement("award_lumberjack_semipro", {
|
||||
-- Professional Lumberjack
|
||||
awards.register_achievement("award_lumberjack_professional", {
|
||||
title = S("Professional Lumberjack"),
|
||||
description = S("Dig 1296 tree blocks."),
|
||||
description = S("Dig 1,296 tree blocks."),
|
||||
icon = "default_tree.png^awards_level4.png",
|
||||
trigger = {
|
||||
type = "dig",
|
||||
@ -363,7 +363,7 @@ awards.register_achievement("award_meseblock", {
|
||||
|
||||
-- You're a copper
|
||||
awards.register_achievement("award_youre_a_copper", {
|
||||
title = S("You're a copper"),
|
||||
title = S("You’re a copper"),
|
||||
description = S("Dig 1,000 copper ores."),
|
||||
icon = "default_stone.png^default_mineral_copper.png",
|
||||
background = "awards_bg_mining.png",
|
||||
|
@ -1,67 +1,178 @@
|
||||
Achievement Unlocked: =
|
||||
Secret Achievement Unlocked: =
|
||||
Achievement Unlocked: %s =
|
||||
Secret Achievement Unlocked: %s =
|
||||
%d/%d chat messages =
|
||||
%d/%d crafted =
|
||||
%d/%d deaths =
|
||||
%d/%d dug =
|
||||
%d/%d game joins =
|
||||
%d/%d placed =
|
||||
%s (got) =
|
||||
%s: %s =
|
||||
%s’s awards: =
|
||||
(Secret Award) =
|
||||
/cawards has been deprecated, use /awards c instead. =
|
||||
<achievement ID> =
|
||||
<name> =
|
||||
A Cat in a Pop-Tart?! =
|
||||
Achievement Unlocked! =
|
||||
Secret Achievement Unlocked! =
|
||||
Light It Up =
|
||||
Place 100 torches. =
|
||||
Light ALL The Things! =
|
||||
Place 1,000 torches. =
|
||||
Saint-Maclou =
|
||||
Place 20 coal checkers. =
|
||||
Castorama =
|
||||
Place 20 iron checkers. =
|
||||
Sam the Trapper =
|
||||
Place 2 trap stones. =
|
||||
Obsessed with Obsidian =
|
||||
Mine 50 obsidian. =
|
||||
On The Way =
|
||||
Place 100 rails. =
|
||||
Lumberjack =
|
||||
Dig 100 tree blocks. =
|
||||
Semi-pro Lumberjack =
|
||||
Dig 1,000 tree blocks. =
|
||||
Professional Lumberjack =
|
||||
Dig 10,000 tree blocks. =
|
||||
L33T Lumberjack =
|
||||
Dig 100,000 tree blocks. =
|
||||
Junglebaby =
|
||||
Dig 100 jungle tree blocks. =
|
||||
Jungleman =
|
||||
Dig 1,000 jungle tree blocks. =
|
||||
First Mese Find =
|
||||
Find some Mese. =
|
||||
You're a copper =
|
||||
Dig 1,000 copper ores. =
|
||||
OMG, Nyan Cat! =
|
||||
Find a nyan cat. =
|
||||
Mini Miner =
|
||||
Dig 100 stone blocks. =
|
||||
Hardened Miner =
|
||||
Dig 1,000 stone blocks =
|
||||
Master Miner =
|
||||
Dig 10,000 stone blocks. =
|
||||
Marchand De Sable =
|
||||
Dig 1,000 sand. =
|
||||
Frequent Visitor =
|
||||
Connect to the server 50 times. =
|
||||
Dying Spree =
|
||||
Die 5 times. =
|
||||
Bot-like =
|
||||
Die 10 times. =
|
||||
You Suck! =
|
||||
Die 100 times. =
|
||||
You're a witch! =
|
||||
Burn to death in a fire. =
|
||||
In the Flow =
|
||||
Die in flowing lava. =
|
||||
This is Sad =
|
||||
Die near diamond ore. =
|
||||
The Stack =
|
||||
Die near bones. =
|
||||
Deep Down =
|
||||
Die below -10000 =
|
||||
In space, no one can hear you scream =
|
||||
Die above 10000 =
|
||||
Achievement Unlocked: =
|
||||
Achievement Unlocked: %s =
|
||||
Achievement not found. =
|
||||
All your awards and statistics have been cleared. You can now start again. =
|
||||
Aspiring Farmer =
|
||||
Awards =
|
||||
Backpacker =
|
||||
Bankier =
|
||||
Bricker =
|
||||
Build a Cave =
|
||||
Castorama =
|
||||
Craft 10 furnaces. =
|
||||
Craft 10 mese lamps. =
|
||||
Craft 100 obsidian bricks. =
|
||||
Craft 100 sandstone bricks. =
|
||||
Craft 100 sticks. =
|
||||
Craft 100 white dyes. =
|
||||
Craft 14 vessels shelves. =
|
||||
Craft 15 chests. =
|
||||
Craft 15 fancy beds. =
|
||||
Craft 200 brick blocks. =
|
||||
Craft 200 stone bricks. =
|
||||
Craft 24 gold block stairs. =
|
||||
Craft 250 white wool. =
|
||||
Craft 3,200 stone bricks. =
|
||||
Craft 30 locked chests. =
|
||||
Craft 4 large bags. =
|
||||
Craft 400 blue dyes. =
|
||||
Craft 400 desert stone bricks. =
|
||||
Craft 400 red dyes. =
|
||||
Craft 400 yellow dyes. =
|
||||
Craft 7 bookshelves. =
|
||||
Craft 8 times flint and steel. =
|
||||
Craft 800 stone bricks. =
|
||||
Craft a diamond block. =
|
||||
Craft: %d×%s =
|
||||
Craft: %s =
|
||||
Crafter of Sticks =
|
||||
Dandelions are Yellow =
|
||||
Desert Discoverer =
|
||||
Desert Dweller =
|
||||
Die %d times. =
|
||||
Die. =
|
||||
Dig 1,000 copper ores. =
|
||||
Dig 1,000 jungle tree blocks. =
|
||||
Dig 1,000 sand. =
|
||||
Dig 1,000 stone blocks. =
|
||||
Dig 1,296 tree blocks. =
|
||||
Dig 10,000 stone blocks. =
|
||||
Dig 100 jungle tree blocks. =
|
||||
Dig 100 stone blocks. =
|
||||
Dig 216 tree blocks. =
|
||||
Dig 36 tree blocks. =
|
||||
Dig 6 tree blocks. =
|
||||
Far Lands =
|
||||
Farming Skills Aquired =
|
||||
Field Worker =
|
||||
Filthy Rich =
|
||||
Firefighter =
|
||||
First Day in the Woods =
|
||||
First Gold Find =
|
||||
First Mese Find =
|
||||
Fortress =
|
||||
Geraniums are Blue =
|
||||
Get the achievements statistics for the given player or yourself =
|
||||
Girl's Best Friend =
|
||||
Glacier Discoverer =
|
||||
Glasser =
|
||||
Gold Rush =
|
||||
Grasslands Discoverer =
|
||||
Hardened Miner =
|
||||
Hardest Block on Earth =
|
||||
Harvest 125 fully grown wheat plants. =
|
||||
Harvest 25 fully grown wheat plants. =
|
||||
Harvest 625 fully grown wheat plants. =
|
||||
Harvest a fully grown wheat plant. =
|
||||
Hotelier =
|
||||
House of Obsidian =
|
||||
In the Dungeon =
|
||||
Industrial Age =
|
||||
Join the game %d times. =
|
||||
Join the game. =
|
||||
Jungle Discoverer =
|
||||
Junglebaby =
|
||||
Jungleman =
|
||||
Lava Miner =
|
||||
Lava and Water =
|
||||
Light It Up =
|
||||
List awards in chat (deprecated) =
|
||||
Little Library =
|
||||
Long Ladder =
|
||||
Lumberjack =
|
||||
Marchand De Sable =
|
||||
Master Miner =
|
||||
Mese Mastery =
|
||||
Mine 18 diamond ores. =
|
||||
Mine 45 gold ores. =
|
||||
Mine 50 obsidian. =
|
||||
Mine a block: %s =
|
||||
Mine a mese block. =
|
||||
Mine a mossy cobblestone. =
|
||||
Mine a nyan cat. =
|
||||
Mine any block while being very close to lava. =
|
||||
Mine blocks: %d×%s =
|
||||
Mine some dry grass. =
|
||||
Mine some grass. =
|
||||
Mine your first cactus. =
|
||||
Mine your first diamond ore. =
|
||||
Mine your first dry shrub. =
|
||||
Mine your first gold ore. =
|
||||
Mine your first ice. =
|
||||
Mine your first jungle grass. =
|
||||
Mine your first mese ore. =
|
||||
Mine your first obsidian. =
|
||||
Mini Miner =
|
||||
Obsessed with Obsidian =
|
||||
On The Way =
|
||||
Outpost =
|
||||
Pharaoh =
|
||||
Place 1,000 torches. =
|
||||
Place 100 rails. =
|
||||
Place 100 stone. =
|
||||
Place 100 torches. =
|
||||
Place 2 trap stones. =
|
||||
Place 20 coal checkers. =
|
||||
Place 20 iron checkers. =
|
||||
Place 40 steel ladders. =
|
||||
Place 400 wooden ladders. =
|
||||
Place a block: %s =
|
||||
Place blocks: %d×%s =
|
||||
Place two snow blocks. =
|
||||
Professional Lumberjack =
|
||||
Put out 1000 fires. =
|
||||
Pyromaniac =
|
||||
Really Well Lit =
|
||||
Roses Are Red =
|
||||
Saint-Maclou =
|
||||
Sam the Trapper =
|
||||
Savannah Discoverer =
|
||||
Secret Achievement Unlocked! =
|
||||
Secret Achievement Unlocked: =
|
||||
Secret Achievement Unlocked: %s =
|
||||
Semi-pro Lumberjack =
|
||||
Show details of an achievement =
|
||||
Show, clear, disable or enable your achievements =
|
||||
Smelter =
|
||||
Treasurer =
|
||||
Unlock this award to find out what it is. =
|
||||
Very Simple Snow Man =
|
||||
Watchtower =
|
||||
Well Lit =
|
||||
Wheat Magnate =
|
||||
White Color Stock =
|
||||
Wool Over Your Eyes =
|
||||
Wow, I am Diamonds! =
|
||||
Write %d chat messages. =
|
||||
Write something in chat. =
|
||||
You have disabled your achievements. =
|
||||
You have enabled your achievements. =
|
||||
You have not unlocked any awards =
|
||||
You've disabled awards. Type /awards enable to reenable. =
|
||||
You’re a copper =
|
||||
[c|clear|disable|enable] =
|
||||
|
10
sfinv.lua
10
sfinv.lua
@ -1,6 +1,14 @@
|
||||
if minetest.get_modpath("sfinv") then
|
||||
local S
|
||||
if (intllib) then
|
||||
dofile(minetest.get_modpath("intllib").."/intllib.lua")
|
||||
S = intllib.Getter(minetest.get_current_modname())
|
||||
else
|
||||
S = function ( s ) return s end
|
||||
end
|
||||
|
||||
sfinv.register_page("awards:awards", {
|
||||
title = "Awards",
|
||||
title = S("Awards"),
|
||||
on_enter = function(self, player, context)
|
||||
context.awards_idx = 1
|
||||
end,
|
||||
|
20
triggers.lua
20
triggers.lua
@ -14,6 +14,14 @@
|
||||
-- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
--
|
||||
|
||||
local S
|
||||
if (intllib) then
|
||||
dofile(minetest.get_modpath("intllib").."/intllib.lua")
|
||||
S = intllib.Getter(minetest.get_current_modname())
|
||||
else
|
||||
S = function ( s ) return s end
|
||||
end
|
||||
|
||||
awards.register_trigger("dig", function(def)
|
||||
local tmp = {
|
||||
award = def.name,
|
||||
@ -25,7 +33,7 @@ awards.register_trigger("dig", function(def)
|
||||
local itemcount = awards.get_item_count(data, "count", tmp.node) or 0
|
||||
return {
|
||||
perc = itemcount / tmp.target,
|
||||
label = itemcount .. " / " .. tmp.target .. " dug" -- TODO: translation
|
||||
label = string.format(S("%d/%d dug"), itemcount, tmp.target)
|
||||
}
|
||||
end
|
||||
end)
|
||||
@ -41,7 +49,7 @@ awards.register_trigger("place", function(def)
|
||||
local itemcount = awards.get_item_count(data, "place", tmp.node) or 0
|
||||
return {
|
||||
perc = itemcount / tmp.target,
|
||||
label = itemcount .. " / " .. tmp.target .. " placed" -- TODO: translation
|
||||
label = string.format(S("%d/%d placed"), itemcount, tmp.target)
|
||||
}
|
||||
end
|
||||
end)
|
||||
@ -56,7 +64,7 @@ awards.register_trigger("death", function(def)
|
||||
local itemcount = data.deaths or 0
|
||||
return {
|
||||
perc = itemcount / tmp.target,
|
||||
label = itemcount .. " deaths, need " .. tmp.target -- TODO: translation
|
||||
label = string.format(S("%d/%d deaths"), itemcount, tmp.target)
|
||||
}
|
||||
end
|
||||
end)
|
||||
@ -71,7 +79,7 @@ awards.register_trigger("chat", function(def)
|
||||
local itemcount = data.chats or 0
|
||||
return {
|
||||
perc = itemcount / tmp.target,
|
||||
label = itemcount .. " / " .. tmp.target .. " line of chat" -- TODO: translation
|
||||
label = string.format(S("%d/%d lines of chat"), itemcount, tmp.target)
|
||||
}
|
||||
end
|
||||
end)
|
||||
@ -87,7 +95,7 @@ awards.register_trigger("join", function(def)
|
||||
local itemcount = data.joins or 0
|
||||
return {
|
||||
perc = itemcount / tmp.target,
|
||||
label = itemcount .. " game joins, need " .. tmp.target -- TODO: translation
|
||||
label = string.format(S("%d/%d game joins"), itemcount, tmp.target)
|
||||
}
|
||||
end
|
||||
end)
|
||||
@ -103,7 +111,7 @@ awards.register_trigger("craft", function(def)
|
||||
local itemcount = awards.get_item_count(data, "craft", tmp.item) or 0
|
||||
return {
|
||||
perc = itemcount / tmp.target,
|
||||
label = itemcount .. " / " .. tmp.target .. " crafted" -- TODO: translation
|
||||
label = string.format(S("%d/%d crafted"), itemcount, tmp.target)
|
||||
}
|
||||
end
|
||||
end)
|
||||
|
Loading…
Reference in New Issue
Block a user