centralize translation `S` code in init.lua to reduce the number of dofile

master
asl97 2014-04-16 02:49:33 +08:00
parent aac6de40a3
commit b32ef86798
11 changed files with 28 additions and 70 deletions

View File

@ -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"),

View File

@ -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"),

View File

@ -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"),

View File

@ -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,

View File

@ -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"),

View File

@ -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"),

View File

@ -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"),

View File

@ -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"),

View File

@ -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"),

View File

@ -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"),

View File

@ -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"),