Compare commits

...

1 Commits

Author SHA1 Message Date
Aleksandr Avdeev
c8f98dd0db Добавить локализацию 2024-11-29 16:05:47 +03:00
2 changed files with 28 additions and 13 deletions

View File

@ -1,3 +1,5 @@
local S = minetest.get_translator("trophies")
--------------------------------------------------------
-- Minetest :: Trophies Mod v1.0 (trophies)
--
@ -9,7 +11,7 @@
minetest.register_node( "trophies:gold_cup", {
-- original image from https://icons8.com/icon/set/trophy/color
description = "Gold Cup Trophy",
description = S("Gold Cup Trophy"),
drawtype = "mesh",
mesh = "trophies_goldcup.obj",
wield_scale = { x = 1.5, y = 1.5, z = 1.5 },
@ -35,7 +37,7 @@ minetest.register_node( "trophies:gold_cup", {
local player_name = player:get_player_name( )
if data.owner and data.grantor ~= player_name then
minetest.chat_send_player( player_name, "This trophy has already been awarded to a player!" )
minetest.chat_send_player( player_name, S("This trophy has already been awarded to a player!") )
return itemstack
end
@ -44,12 +46,12 @@ minetest.register_node( "trophies:gold_cup", {
data.owner = ""
data.grantor = player_name
data.oldtime = os.time( )
data.title = "Achievement of Excellence"
data.message = "In Recognition of Outstanding Bravery in Competition"
data.title = S("Achievement of Excellence")
data.message = S("In Recognition of Outstanding Bravery in Competition")
end
local output_text = string.format( "%s (awarded to %s)\n\n\"%s\"\n\nPresented on %s by %s",
data.title, data.owner == default.OWNER_NOBODY and "nobody" or data.owner, data.message, os.date( "%x", data.oldtime ), data.grantor )
data.title, data.owner == default.OWNER_NOBODY and "nobody" or data.owner, data.message, os.date( "%x", data.oldtime ), data.grantor)
local formspec =
"size[8,6.5]" ..
@ -71,22 +73,22 @@ minetest.register_node( "trophies:gold_cup", {
minetest.create_form( nil, player_name, get_editor_formspec( ), function ( _, player, fields )
if fields.save or fields.preview then
if fields.owner == player_name then
minetest.chat_send_player( player_name, "You cannot award a trophy to yourself." )
minetest.chat_send_player( player_name, S("You cannot award a trophy to yourself."))
return
elseif not string.find( fields.owner, "^[-_A-Za-z0-9]+$" ) then
minetest.chat_send_player( player_name, "The specified winner is invalid." )
minetest.chat_send_player( player_name, S("The specified winner is invalid.") )
return
elseif string.len( fields.message ) < 5 then
minetest.chat_send_player( player_name, "The specified message is too short." )
minetest.chat_send_player( player_name, S("The specified message is too short.") )
return
elseif string.len( fields.message ) > 100 then
minetest.chat_send_player( player_name, "The specified message is too long." )
minetest.chat_send_player( player_name, S("The specified message is too long.") )
return
elseif string.len( fields.title ) < 5 then
minetest.chat_send_player( player_name, "The specified title is too short." )
minetest.chat_send_player( player_name, S("The specified title is too short.") )
return
elseif string.len( fields.title ) > 30 then
minetest.chat_send_player( player_name, "The specified title is too long." )
minetest.chat_send_player( player_name, S("The specified title is too long.") )
return
end
end
@ -103,7 +105,7 @@ minetest.register_node( "trophies:gold_cup", {
itemstack:set_metadata( minetest.serialize( data ) )
player:set_wielded_item( itemstack )
minetest.chat_send_player( player_name, "The trophy has been inscribed with your new message!" )
minetest.chat_send_player( player_name, S("The trophy has been inscribed with your new message!") )
minetest.destroy_form( player_name )
end
@ -119,7 +121,7 @@ minetest.register_node( "trophies:gold_cup", {
local player_name = placer:get_player_name( )
if not data.owner then
minetest.chat_send_player( player_name, "This trophy cannot be placed until awarded to a player!" )
minetest.chat_send_player( player_name, S("This trophy cannot be placed until awarded to a player!") )
return itemstack
end

View File

@ -0,0 +1,13 @@
# textdomain: trophies
Gold Cup Trophy=Золотой трофейный кубок
This trophy has already been awarded to a player!=Этот трофей уже был присужден игроку!
Achievement of Excellence=Достижения заслуг
You cannot award a trophy to yourself.=Вы не можете присудить трофей себе.
The specified winner is invalid.=Указанный победитель недействителен.
The specified message is too short.=Указанное сообщение слишком короткое.
The specified message is too long.=Указанное сообщение слишком длинное.
The specified title is too short.=Указанное название слишком короткое.
The specified title is too long.=Указанное название слишком длинное.
The trophy has been inscribed with your new message!=Трофей был надписан вашим новым сообщением!
This trophy cannot be placed until awarded to a player!=Этот трофей нельзя разместить, пока он не будет присужден игроку!