Add localization support
This commit is contained in:
parent
df06d014aa
commit
9959778788
1
TODO.txt
1
TODO.txt
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
TODO:
|
TODO:
|
||||||
- add localization support
|
|
||||||
- add Spanish translation
|
- add Spanish translation
|
||||||
|
@ -9,3 +9,4 @@ next
|
|||||||
- hovercrafts can now be owned & unusable by non-owners
|
- hovercrafts can now be owned & unusable by non-owners
|
||||||
- made dependencies on default & wool optional (required for craft recipes)
|
- made dependencies on default & wool optional (required for craft recipes)
|
||||||
- changed craft recipe to optionally use basic_materials:motor
|
- changed craft recipe to optionally use basic_materials:motor
|
||||||
|
- added localization support
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
|
|
||||||
|
local S = core.get_translator("hovercraft")
|
||||||
|
|
||||||
|
|
||||||
function hover:register_hovercraft(name, def)
|
function hover:register_hovercraft(name, def)
|
||||||
local basename = name:gsub('^:', '')
|
local basename = name:gsub('^:', '')
|
||||||
|
|
||||||
@ -36,14 +39,14 @@ function hover:register_hovercraft(name, def)
|
|||||||
|
|
||||||
local pname = puncher:get_player_name()
|
local pname = puncher:get_player_name()
|
||||||
if hover.ownable and self.owner and pname ~= self.owner then
|
if hover.ownable and self.owner and pname ~= self.owner then
|
||||||
core.chat_send_player(pname, "You cannot take " .. self.owner .. "'s hovercraft.")
|
core.chat_send_player(pname, S("You cannot take @1's hovercraft.", self.owner))
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local stack = ItemStack(basename)
|
local stack = ItemStack(basename)
|
||||||
local pinv = puncher:get_inventory()
|
local pinv = puncher:get_inventory()
|
||||||
if not pinv:room_for_item("main", stack) then
|
if not pinv:room_for_item("main", stack) then
|
||||||
core.chat_send_player(pname, "You don't have room in your inventory.")
|
core.chat_send_player(pname, S("You don't have room in your inventory."))
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -73,7 +76,7 @@ function hover:register_hovercraft(name, def)
|
|||||||
elseif not self.player then
|
elseif not self.player then
|
||||||
local pname = clicker:get_player_name()
|
local pname = clicker:get_player_name()
|
||||||
if hover.ownable and self.owner and pname ~= self.owner then
|
if hover.ownable and self.owner and pname ~= self.owner then
|
||||||
core.chat_send_player(pname, "You cannot ride " .. self.owner .. "'s hovercraft.")
|
core.chat_send_player(pname, S("You cannot ride @1's hovercraft.", self.owner))
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
11
init.lua
11
init.lua
@ -6,8 +6,11 @@ hover.modpath = core.get_modpath(hover.modname)
|
|||||||
dofile(hover.modpath .. "/settings.lua")
|
dofile(hover.modpath .. "/settings.lua")
|
||||||
dofile(hover.modpath .. "/hover.lua")
|
dofile(hover.modpath .. "/hover.lua")
|
||||||
|
|
||||||
|
|
||||||
|
local S = core.get_translator("hovercraft")
|
||||||
|
|
||||||
hover:register_hovercraft(":hovercraft:hover_red" ,{
|
hover:register_hovercraft(":hovercraft:hover_red" ,{
|
||||||
description = "Red Hovercraft",
|
description = S("Red Hovercraft"),
|
||||||
textures = {"hovercraft_red.png"},
|
textures = {"hovercraft_red.png"},
|
||||||
inventory_image = "hovercraft_red_inv.png",
|
inventory_image = "hovercraft_red_inv.png",
|
||||||
max_speed = 10,
|
max_speed = 10,
|
||||||
@ -19,7 +22,7 @@ hover:register_hovercraft(":hovercraft:hover_red" ,{
|
|||||||
})
|
})
|
||||||
|
|
||||||
hover:register_hovercraft(":hovercraft:hover_blue" ,{
|
hover:register_hovercraft(":hovercraft:hover_blue" ,{
|
||||||
description = "Blue Hovercraft",
|
description = S("Blue Hovercraft"),
|
||||||
textures = {"hovercraft_blue.png"},
|
textures = {"hovercraft_blue.png"},
|
||||||
inventory_image = "hovercraft_blue_inv.png",
|
inventory_image = "hovercraft_blue_inv.png",
|
||||||
max_speed = 12,
|
max_speed = 12,
|
||||||
@ -31,7 +34,7 @@ hover:register_hovercraft(":hovercraft:hover_blue" ,{
|
|||||||
})
|
})
|
||||||
|
|
||||||
hover:register_hovercraft(":hovercraft:hover_green" ,{
|
hover:register_hovercraft(":hovercraft:hover_green" ,{
|
||||||
description = "Green Hovercraft",
|
description = S("Green Hovercraft"),
|
||||||
textures = {"hovercraft_green.png"},
|
textures = {"hovercraft_green.png"},
|
||||||
inventory_image = "hovercraft_green_inv.png",
|
inventory_image = "hovercraft_green_inv.png",
|
||||||
max_speed = 8,
|
max_speed = 8,
|
||||||
@ -43,7 +46,7 @@ hover:register_hovercraft(":hovercraft:hover_green" ,{
|
|||||||
})
|
})
|
||||||
|
|
||||||
hover:register_hovercraft(":hovercraft:hover_yellow" ,{
|
hover:register_hovercraft(":hovercraft:hover_yellow" ,{
|
||||||
description = "Yellow Hovercraft",
|
description = S("Yellow Hovercraft"),
|
||||||
textures = {"hovercraft_yellow.png"},
|
textures = {"hovercraft_yellow.png"},
|
||||||
inventory_image = "hovercraft_yellow_inv.png",
|
inventory_image = "hovercraft_yellow_inv.png",
|
||||||
max_speed = 8,
|
max_speed = 8,
|
||||||
|
12
locale/template.txt
Normal file
12
locale/template.txt
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
# textdomain:hovercraft
|
||||||
|
|
||||||
|
# Translators:
|
||||||
|
|
||||||
|
|
||||||
|
Red Hovercraft=
|
||||||
|
Blue Hovercraft=
|
||||||
|
Green Hovercraft=
|
||||||
|
Yellow Hovercraft=
|
||||||
|
You don't have room in your inventory.=
|
||||||
|
You cannot take @1's hovercraft.=
|
||||||
|
You cannot ride @1's hovercraft.=
|
1
mod.conf
1
mod.conf
@ -1,4 +1,5 @@
|
|||||||
name = hovercraft_ad
|
name = hovercraft_ad
|
||||||
description = A fun alternative mode of transport.
|
description = A fun alternative mode of transport.
|
||||||
author = Stuart Jones (stu)
|
author = Stuart Jones (stu)
|
||||||
|
min_minetest_version = 5.0
|
||||||
optional_depends = default, wool, basic_materials
|
optional_depends = default, wool, basic_materials
|
||||||
|
Loading…
x
Reference in New Issue
Block a user