Ready for Translation

This commit is contained in:
1F616EMO 2024-02-15 07:48:44 +08:00
parent 9ed3698197
commit 46305b1ee3
No known key found for this signature in database
GPG Key ID: EF52EFA8E05859B2
3 changed files with 97 additions and 32 deletions

61
gui.lua
View File

@ -113,22 +113,21 @@ p.configure_gui = flow.make_gui(function(player, ctx)
local category = tostring(fields.category) or ""
local descr = tostring(fields.descr) or ""
if size_left < 0 or size_left > 10
or size_right < 0 or size_right > 10
or size_up < 0 or size_up > 10
or size_down < 0 or size_down > 10
or size_front < 0 or size_front > 10
or size_back < 0 or size_back > 10
or not category or not descr then
minetest.chat_send_player(name,
S('Error: Not all fields have been filled in or the area is too large.'))
if math.min(size_left, size_right, size_up, size_down, size_front, size_back) < 0
or not category or not descr then
minetest.chat_send_player(name, S("Error: Not all fields have been filled."))
return
end
if math.max(size_left, size_right, size_up, size_down, size_front, size_back) > 10 then
minetest.chat_send_player(name, S("Error: The area is too large."))
return
end
if apartment.apartments[category] and apartment.apartments[category][descr] then
minetest.chat_send_player(name,
S(
"Error: The apartment @1@@@2 already exists. Please choose a different name or category.",
S("Error: The apartment @1@@@2 already exists. " ..
"Please choose a different name or category.",
descr, category))
return
end
@ -196,11 +195,12 @@ p.panel_control = flow.make_gui(function(player, ctx)
local status, msg = apartment.rent(pos, original_owner, nil, player)
if status then
minetest.chat_send_player(name,
S("You have ended your rent of apartment @1@@@2. It is free for others to rent again.", descr,
category))
S("You have ended your rent of apartment @1@@@2. It is free for others to rent again.",
descr, category))
else
minetest.chat_send_player(name, 'Something went wrong when giving back the apartment @1@@@2. (@3)',
descr, category, msg)
minetest.chat_send_player(name,
S('Something went wrong when giving back the apartment @1@@@2. (@3)',
descr, category, msg))
end
return true
end
@ -224,8 +224,8 @@ p.panel_control = flow.make_gui(function(player, ctx)
if not (apartment.apartments[category] and apartment.apartments[category][descr]) then
minetest.chat_send_player(name,
S(
"This apartment (@1@@@2) is not registered. Please unrent it and ask the original builder to re-configure this panel.",
S("This apartment (@1@@@2) is not registered. " ..
"Please unrent it and ask the original builder to re-configure this panel.",
descr, category))
return true
end
@ -233,8 +233,8 @@ p.panel_control = flow.make_gui(function(player, ctx)
for k, v in pairs(apartment.apartments[category]) do
if v and v.owner == name then
minetest.chat_send_player(name,
S(
"Sorry, you can only rent one apartment per category at a time. You have already rented apartment @1@@@2.",
S("Sorry, you can only rent one apartment per category at a time. " ..
"You have already rented apartment @1@@@2.",
descr, category))
return false
end
@ -245,8 +245,9 @@ p.panel_control = flow.make_gui(function(player, ctx)
minetest.chat_send_player(name,
S("You have rented apartment @1@@@2. Enjoy your stay!", descr, category))
else
minetest.chat_send_player(name, 'Something went wrong when renting the apartment @1@@@2. (@3)',
descr, category, msg)
minetest.chat_send_player(name,
S('Something went wrong when renting the apartment @1@@@2. (@3)',
descr, category, msg))
end
return true
end
@ -277,8 +278,8 @@ p.panel_control = flow.make_gui(function(player, ctx)
owner, descr, category))
else
minetest.chat_send_player(name,
'Something went wrong when throwing @1 out of the apartment @2@@@3. (@4)', owner, descr, category,
msg)
S('Something went wrong when throwing @1 out of the apartment @2@@@3. (@4)',
owner, descr, category, msg))
end
return true
end
@ -310,12 +311,12 @@ p.panel_control = flow.make_gui(function(player, ctx)
gui.HBox {
gui.VBox {
gui.Label {
label = S("Back\n@1", size_back),
label = S("Back") .. "\n" .. size_back,
w = 1, expand = true, align_h = "center"
},
gui.HBox {
gui.Label {
label = S("Left\n@1", size_left),
label = S("Left") .. "\n" .. size_left,
w = 1, expand = true,
},
gui.Image {
@ -323,27 +324,27 @@ p.panel_control = flow.make_gui(function(player, ctx)
expand = true,
},
gui.Label {
label = S("Right\n@1", size_right),
label = S("Right") .. "\n" .. size_right,
w = 1, expand = true,
},
},
gui.Label {
label = S("Front\n@1", size_front),
label = S("Front") .. "\n" .. size_front,
w = 1, expand = true, align_h = "center"
},
},
gui.VBox { w = 4, expand = true, align_h = "right",
gui.HBox {
gui.Label {
label = S("Up\n@1", size_up),
label = S("Up") .. "\n" .. size_up,
expand = true, w = 1,
},
gui.Label {
label = S("Down\n@1", size_down),
label = S("Down") .. "\n" .. size_down,
expand = true, w = 1,
},
},
gui.Spacer {},
gui.Spacer{},
btn,
}
}

View File

@ -292,6 +292,7 @@ end
minetest.register_craftitem("apartment:configuration_copier", {
description = S("Apartment Configuaration Copier"),
inventory_image = "apartment_configuration_copier.png",
stack_max = 1,
on_use = function(itemstack, user, pointed_thing)
if not user:is_player() then return end
local name = user:get_player_name()
@ -363,7 +364,6 @@ minetest.register_node("apartment:apartment_free", {
})
minetest.register_node("apartment:apartment_occupied", {
description = S("Apartment Management Panel") .. " Occupied",
drawtype = "nodebox",
tiles = { "default_steel_block.png", "default_steel_block.png", "default_steel_block.png",
"default_steel_block.png",
@ -393,7 +393,7 @@ minetest.register_node("apartment:apartment_occupied", {
if apartment.enable_aphome_command then
minetest.register_chatcommand("aphome", {
params = "[<category>]",
params = S("[<category>]"),
description = S("Teleports you back to the apartment you rented."),
privs = { home = true },
func = function(name, param)

64
locale/template.txt Normal file
View File

@ -0,0 +1,64 @@
# textdomain: apartment
##[ chg_owner.lua ]##
@1 in Ap. @2 (@3)=
Apartment @1 (@2)=
Rent apartment @1 here by right-clicking this panel!=
Apartment rental control panel for apartment @1 (@2)=
##[ gui.lua ]##
Apartment Configuration=
Category=
In one category, every player can only rent one apartment.=
Name or ID=
This is the unique ID of this apartment in this category.=
The apartment shall extend this many blocks from this panel:=
Back=
Left=
Right=
Front=
Up=
Down=
Abort=
Store and Offer=
Error: Not all fields have been filled.=
Error: The area is too large.=
Error: The apartment @1@@@2 already exists. Please choose a different name or category.=
Apartment @1@@@2 is ready for rental.=
Failed to create apartment @1@@@2. (@3)=
This apartment @nhave been rented.=
This apartment @nwas glitched.=
Unrent=
You have ended your rent of apartment @1@@@2. It is free for others to rent again.=
Something went wrong when giving back the apartment @1@@@2. (@3)=
Dig the panel @nto remove this apartment.=
Rent=
This apartment (@1@@@2) is not registered. Please unrent it and ask the original builder to re-configure this panel.=
Sorry, you can only rent one apartment per category at a time. You have already rented apartment @1@@@2.=
You have rented apartment @1@@@2. Enjoy your stay!=
Something went wrong when renting the apartment @1@@@2. (@3)=
Force Unrent=
Player @1 has been thrown out of apartment @2@@@3. It can now be rented by another player.=
Something went wrong when throwing @1 out of the apartment @2@@@3. (@4)=
Apartment @1@@@2=
Owner: @1=
Now rented by: @1=
The apartment extends this many blocks from this panel:=
##[ init.lua ]##
Allows player to throw other players out from apartments not owned by them.=
Apartment Management Panel (unconfigured)=
Apartment Management Panel (owned by @1)=
Sorry. Only the original owner of this apartment control panel can dig it.=
The apartment is currently rented to @1. Please end that first.=
Error: Could not find information about the apartment panel that is to be removed.=
Removed apartment @1@@@2 successfully.=
Apartment Configuaration Copier=
Please configure the panel first before copying configurations from it.=
Apartment Configuaration Copier@nU:@1 D:@2 L:@3 R:@4 F:@5 B:@6@n@7@@@8@nRightclick on a panel to paste the configurations.=
Configuration copied.=
Apartment Management Panel=
[<category>]=
Teleports you back to the apartment you rented.=
You do not have an apartment in category @1.=
Welcome back to your apartment @1@@@2.=