diff --git a/crafts.lua b/crafts.lua index 3d5b7cf5..fbc55bfd 100644 --- a/crafts.lua +++ b/crafts.lua @@ -6,14 +6,7 @@ -- License: GPL -- --- Boilerplate to support localized strings if intllib mod is installed. -local S -if homedecor.intllib_modpath then - dofile(homedecor.intllib_modpath.."/intllib.lua") - S = intllib.Getter(minetest.get_current_modname()) -else - S = function ( s ) return s end -end +local S = homedecor.gettext -- misc stuff :D diff --git a/door_models.lua b/door_models.lua index 4578e10c..870a4acf 100644 --- a/door_models.lua +++ b/door_models.lua @@ -1,12 +1,5 @@ --- Boilerplate to support localized strings if intllib mod is installed. -local S -if homedecor.intllib_modpath then - dofile(homedecor.intllib_modpath.."/intllib.lua") - S = intllib.Getter(minetest.get_current_modname()) -else - S = function ( s ) return s end -end +local S = homedecor.gettext homedecor.door_models = { { diff --git a/doors_and_gates.lua b/doors_and_gates.lua index 11d8403e..7bc30d0e 100644 --- a/doors_and_gates.lua +++ b/doors_and_gates.lua @@ -1,13 +1,6 @@ -- Node definitions for Homedecor doors --- Boilerplate to support localized strings if intllib mod is installed. -local S -if homedecor.intllib_modpath then - dofile(homedecor.intllib_modpath.."/intllib.lua") - S = intllib.Getter(minetest.get_current_modname()) -else - S = function ( s ) return s end -end +local S = homedecor.gettext -- doors diff --git a/electronics.lua b/electronics.lua index 018ece45..fefdba38 100644 --- a/electronics.lua +++ b/electronics.lua @@ -1,13 +1,6 @@ -- Various home electronics --- Boilerplate to support localized strings if intllib mod is installed. -local S -if homedecor.intllib_modpath then - dofile(homedecor.intllib_modpath.."/intllib.lua") - S = intllib.Getter(minetest.get_current_modname()) -else - S = function ( s ) return s end -end +local S = homedecor.gettext minetest.register_node('homedecor:speaker', { description = S("Large Stereo Speaker"), diff --git a/fences.lua b/fences.lua index 3953c17e..a7877b93 100644 --- a/fences.lua +++ b/fences.lua @@ -1,13 +1,6 @@ -- This file adds fences of various types --- Boilerplate to support localized strings if intllib mod is installed. -local S -if homedecor.intllib_modpath then - dofile(homedecor.intllib_modpath.."/intllib.lua") - S = intllib.Getter(minetest.get_current_modname()) -else - S = function ( s ) return s end -end +local S = homedecor.gettext minetest.register_node("homedecor:fence_brass", { description = S("Brass Fence/railing"), diff --git a/furnaces.lua b/furnaces.lua index 4150c4eb..9fb0a8b9 100644 --- a/furnaces.lua +++ b/furnaces.lua @@ -1,13 +1,6 @@ -- This code supplies an oven/stove. Basically it's just a copy of the default furnace with different textures. --- Boilerplate to support localized strings if intllib mod is installed. -local S -if homedecor.intllib_modpath then - dofile(homedecor.intllib_modpath.."/intllib.lua") - S = intllib.Getter(minetest.get_current_modname()) -else - S = function ( s ) return s end -end +local S = homedecor.gettext local function hacky_swap_node(pos,name) local node = minetest.get_node(pos) diff --git a/init.lua b/init.lua index d782aba4..f9497d02 100644 --- a/init.lua +++ b/init.lua @@ -27,6 +27,7 @@ if homedecor.intllib_modpath then else S = function ( s ) return s end end +homedecor.gettext = S local dbg = function(s) if homedecor.debug == 1 then diff --git a/kitchen_cabinet.lua b/kitchen_cabinet.lua index 012905c1..084d596d 100644 --- a/kitchen_cabinet.lua +++ b/kitchen_cabinet.lua @@ -1,13 +1,6 @@ -- This file supplies Kitchen cabinets and kitchen sink --- Boilerplate to support localized strings if intllib mod is installed. -local S -if homedecor.intllib_modpath then - dofile(homedecor.intllib_modpath.."/intllib.lua") - S = intllib.Getter(minetest.get_current_modname()) -else - S = function ( s ) return s end -end +local S = homedecor.gettext minetest.register_node('homedecor:kitchen_cabinet', { description = S("Kitchen Cabinet"), diff --git a/lighting.lua b/lighting.lua index 93c0c047..4fbf5d84 100644 --- a/lighting.lua +++ b/lighting.lua @@ -1,14 +1,7 @@ -- This file supplies glowlights --- Boilerplate to support localized strings if intllib mod is installed. -local S -if homedecor.intllib_modpath then - dofile(homedecor.intllib_modpath.."/intllib.lua") - S = intllib.Getter(minetest.get_current_modname()) -else - S = function ( s ) return s end -end +local S = homedecor.gettext local colors = {"yellow","white"} diff --git a/locked.lua b/locked.lua index 506b655f..f05b8426 100644 --- a/locked.lua +++ b/locked.lua @@ -7,14 +7,7 @@ -- License: LGPL -- --- Boilerplate to support localized strings if intllib mod is installed. -local S -if homedecor.intllib_modpath then - dofile(homedecor.intllib_modpath.."/intllib.lua") - S = intllib.Getter(minetest.get_current_modname()) -else - S = function ( s ) return s end -end +local S = homedecor.gettext --[[ | create_locked ( name, infotext ) diff --git a/misc_nodes.lua b/misc_nodes.lua index b3bba7b3..34fce576 100644 --- a/misc_nodes.lua +++ b/misc_nodes.lua @@ -1,13 +1,6 @@ -- Various misc. nodes --- Boilerplate to support localized strings if intllib mod is installed. -local S -if homedecor.intllib_modpath then - dofile(homedecor.intllib_modpath.."/intllib.lua") - S = intllib.Getter(minetest.get_current_modname()) -else - S = function ( s ) return s end -end +local S = homedecor.gettext minetest.register_node('homedecor:ceiling_paint', { description = S("Textured Ceiling Paint"), diff --git a/nightstands.lua b/nightstands.lua index bab2e26b..96fba084 100644 --- a/nightstands.lua +++ b/nightstands.lua @@ -1,13 +1,6 @@ -- This file supplies nightstands --- Boilerplate to support localized strings if intllib mod is installed. -local S -if homedecor.intllib_modpath then - dofile(homedecor.intllib_modpath.."/intllib.lua") - S = intllib.Getter(minetest.get_current_modname()) -else - S = function ( s ) return s end -end +local S = homedecor.gettext minetest.register_node('homedecor:nightstand_oak_one_drawer', { drawtype = "nodebox", diff --git a/ownership.lua b/ownership.lua index 70491d93..a9ca82fa 100644 --- a/ownership.lua +++ b/ownership.lua @@ -1,10 +1,5 @@ -local S -if homedecor.intllib_modpath then - dofile(homedecor.intllib_modpath.."/intllib.lua") - S = intllib.Getter(minetest.get_current_modname()) -else - S = function ( s ) return s end -end + +local S = homedecor.gettext function homedecor:node_is_owned(pos, placer) local ownername = false diff --git a/refrigerator.lua b/refrigerator.lua index 6da80694..a2cffb85 100644 --- a/refrigerator.lua +++ b/refrigerator.lua @@ -1,13 +1,6 @@ -- This file supplies refrigerators --- Boilerplate to support localized strings if intllib mod is installed. -local S -if homedecor.intllib_modpath then - dofile(homedecor.intllib_modpath.."/intllib.lua") - S = intllib.Getter(minetest.get_current_modname()) -else - S = function ( s ) return s end -end +local S = homedecor.gettext minetest.register_node('homedecor:refrigerator', { drawtype = "nodebox", diff --git a/shingles.lua b/shingles.lua index cdce5448..3f1acf7b 100644 --- a/shingles.lua +++ b/shingles.lua @@ -1,13 +1,6 @@ -- Various kidns of shingles --- Boilerplate to support localized strings if intllib mod is installed. -local S -if homedecor.intllib_modpath then - dofile(homedecor.intllib_modpath.."/intllib.lua") - S = intllib.Getter(minetest.get_current_modname()) -else - S = function ( s ) return s end -end +local S = homedecor.gettext minetest.register_node("homedecor:skylight", { description = S("Glass Skylight"), diff --git a/shutters.lua b/shutters.lua index cdabe5e7..ded5a3d5 100644 --- a/shutters.lua +++ b/shutters.lua @@ -1,13 +1,6 @@ -- Various kinds of window shutters --- Boilerplate to support localized strings if intllib mod is installed. -local S -if homedecor.intllib_modpath then - dofile(homedecor.intllib_modpath.."/intllib.lua") - S = intllib.Getter(minetest.get_current_modname()) -else - S = function ( s ) return s end -end +local S = homedecor.gettext local shutters = { {"oak", "Unpainted oak"}, diff --git a/signs_lib.lua b/signs_lib.lua index 7018e4eb..f988a489 100644 --- a/signs_lib.lua +++ b/signs_lib.lua @@ -1,12 +1,5 @@ --- Boilerplate to support localized strings if intllib mod is installed. -local S -if homedecor.intllib_modpath then - dofile(homedecor.intllib_modpath.."/intllib.lua") - S = intllib.Getter(minetest.get_current_modname()) -else - S = function ( s ) return s end -end +local S = homedecor.gettext -- CONSTANTS diff --git a/slopes.lua b/slopes.lua index 60da99b8..1436fab4 100644 --- a/slopes.lua +++ b/slopes.lua @@ -1,13 +1,6 @@ -- Various kinds of shingles --- Boilerplate to support localized strings if intllib mod is installed. -local S -if homedecor.intllib_modpath then - dofile(homedecor.intllib_modpath.."/intllib.lua") - S = intllib.Getter(minetest.get_current_modname()) -else - S = function ( s ) return s end -end +local S = homedecor.gettext -- Corner shingle nodes, courtesy Bas080 diff --git a/tables.lua b/tables.lua index f39b8937..fcdcac86 100644 --- a/tables.lua +++ b/tables.lua @@ -1,13 +1,6 @@ -- Various kinds of tables --- Boilerplate to support localized strings if intllib mod is installed. -local S -if homedecor.intllib_modpath then - dofile(homedecor.intllib_modpath.."/intllib.lua") - S = intllib.Getter(minetest.get_current_modname()) -else - S = function ( s ) return s end -end +local S = homedecor.gettext materials = { {"glass","Glass"},