centralize translation S
code in init.lua to reduce the number of dofile
This commit is contained in:
parent
aac6de40a3
commit
b32ef86798
@ -1,11 +1,6 @@
|
||||
-- Boilerplate to support localized strings if intllib mod is installed.
|
||||
-- main `S` code in init.lua
|
||||
local S
|
||||
if (minetest.get_modpath("intllib")) then
|
||||
dofile(minetest.get_modpath("intllib").."/intllib.lua")
|
||||
S = intllib.Getter(minetest.get_current_modname())
|
||||
else
|
||||
S = function ( s ) return s end
|
||||
end
|
||||
S = farming.S
|
||||
|
||||
minetest.register_node("farming_plus:banana_sapling", {
|
||||
description = S("Banana Tree Sapling"),
|
||||
|
@ -1,11 +1,6 @@
|
||||
-- Boilerplate to support localized strings if intllib mod is installed.
|
||||
-- main `S` code in init.lua
|
||||
local S
|
||||
if (minetest.get_modpath("intllib")) then
|
||||
dofile(minetest.get_modpath("intllib").."/intllib.lua")
|
||||
S = intllib.Getter(minetest.get_current_modname())
|
||||
else
|
||||
S = function ( s ) return s end
|
||||
end
|
||||
S = farming.S
|
||||
|
||||
minetest.register_craftitem("farming_plus:carrot_seed", {
|
||||
description = S("Carrot Seeds"),
|
||||
|
@ -1,11 +1,6 @@
|
||||
-- Boilerplate to support localized strings if intllib mod is installed.
|
||||
-- main `S` code in init.lua
|
||||
local S
|
||||
if (minetest.get_modpath("intllib")) then
|
||||
dofile(minetest.get_modpath("intllib").."/intllib.lua")
|
||||
S = intllib.Getter(minetest.get_current_modname())
|
||||
else
|
||||
S = function ( s ) return s end
|
||||
end
|
||||
S = farming.S
|
||||
|
||||
minetest.register_node("farming_plus:cocoa_sapling", {
|
||||
description = S("Cocoa Tree Sapling"),
|
||||
|
8
init.lua
8
init.lua
@ -1,5 +1,13 @@
|
||||
farming.registered_plants = {}
|
||||
|
||||
-- Boilerplate to support localized strings if intllib mod is installed.
|
||||
if (minetest.get_modpath("intllib")) then
|
||||
dofile(minetest.get_modpath("intllib").."/intllib.lua")
|
||||
farming.S = intllib.Getter(minetest.get_current_modname())
|
||||
else
|
||||
farming.S = function ( s ) return s end
|
||||
end
|
||||
|
||||
function farming:add_plant(full_grown, names, interval, chance)
|
||||
minetest.register_abm({
|
||||
nodenames = names,
|
||||
|
@ -1,11 +1,6 @@
|
||||
-- Boilerplate to support localized strings if intllib mod is installed.
|
||||
-- main `S` code in init.lua
|
||||
local S
|
||||
if (minetest.get_modpath("intllib")) then
|
||||
dofile(minetest.get_modpath("intllib").."/intllib.lua")
|
||||
S = intllib.Getter(minetest.get_current_modname())
|
||||
else
|
||||
S = function ( s ) return s end
|
||||
end
|
||||
S = farming.S
|
||||
|
||||
minetest.register_craftitem("farming_plus:orange_seed", {
|
||||
description = S("Orange Seeds"),
|
||||
|
@ -1,11 +1,6 @@
|
||||
-- Boilerplate to support localized strings if intllib mod is installed.
|
||||
-- main `S` code in init.lua
|
||||
local S
|
||||
if (minetest.get_modpath("intllib")) then
|
||||
dofile(minetest.get_modpath("intllib").."/intllib.lua")
|
||||
S = intllib.Getter(minetest.get_current_modname())
|
||||
else
|
||||
S = function ( s ) return s end
|
||||
end
|
||||
S = farming.S
|
||||
|
||||
minetest.register_craftitem("farming_plus:potato_seed", {
|
||||
description = ("Potato Seeds"),
|
||||
|
@ -1,11 +1,6 @@
|
||||
-- Boilerplate to support localized strings if intllib mod is installed.
|
||||
-- main `S` code in init.lua
|
||||
local S
|
||||
if (minetest.get_modpath("intllib")) then
|
||||
dofile(minetest.get_modpath("intllib").."/intllib.lua")
|
||||
S = intllib.Getter(minetest.get_current_modname())
|
||||
else
|
||||
S = function ( s ) return s end
|
||||
end
|
||||
S = farming.S
|
||||
|
||||
minetest.register_craftitem(":farming:pumpkin_seed", {
|
||||
description = S("Pumpkin Seed"),
|
||||
|
@ -1,11 +1,6 @@
|
||||
-- Boilerplate to support localized strings if intllib mod is installed.
|
||||
-- main `S` code in init.lua
|
||||
local S
|
||||
if (minetest.get_modpath("intllib")) then
|
||||
dofile(minetest.get_modpath("intllib").."/intllib.lua")
|
||||
S = intllib.Getter(minetest.get_current_modname())
|
||||
else
|
||||
S = function ( s ) return s end
|
||||
end
|
||||
S = farming.S
|
||||
|
||||
minetest.register_craftitem("farming_plus:rhubarb_seed", {
|
||||
description = S("Rhubarb Seeds"),
|
||||
|
@ -1,11 +1,6 @@
|
||||
-- Boilerplate to support localized strings if intllib mod is installed.
|
||||
-- main `S` code in init.lua
|
||||
local S
|
||||
if (minetest.get_modpath("intllib")) then
|
||||
dofile(minetest.get_modpath("intllib").."/intllib.lua")
|
||||
S = intllib.Getter(minetest.get_current_modname())
|
||||
else
|
||||
S = function ( s ) return s end
|
||||
end
|
||||
S = farming.S
|
||||
|
||||
minetest.register_craftitem("farming_plus:strawberry_seed", {
|
||||
description = S("Strawberry Seeds"),
|
||||
|
@ -1,11 +1,6 @@
|
||||
-- Boilerplate to support localized strings if intllib mod is installed.
|
||||
-- main `S` code in init.lua
|
||||
local S
|
||||
if (minetest.get_modpath("intllib")) then
|
||||
dofile(minetest.get_modpath("intllib").."/intllib.lua")
|
||||
S = intllib.Getter(minetest.get_current_modname())
|
||||
else
|
||||
S = function ( s ) return s end
|
||||
end
|
||||
S = farming.S
|
||||
|
||||
minetest.register_craftitem("farming_plus:tomato_seed", {
|
||||
description = S("Tomato Seeds"),
|
||||
|
9
weed.lua
9
weed.lua
@ -1,11 +1,6 @@
|
||||
-- Boilerplate to support localized strings if intllib mod is installed.
|
||||
-- main `S` code in init.lua
|
||||
local S
|
||||
if (minetest.get_modpath("intllib")) then
|
||||
dofile(minetest.get_modpath("intllib").."/intllib.lua")
|
||||
S = intllib.Getter(minetest.get_current_modname())
|
||||
else
|
||||
S = function ( s ) return s end
|
||||
end
|
||||
S = farming.S
|
||||
|
||||
minetest.register_node(":farming:weed", {
|
||||
description = S("Weed"),
|
||||
|
Loading…
x
Reference in New Issue
Block a user