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