diff --git a/crafts.lua b/crafts.lua index 3d5b7cf..fbc55bf 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 4578e10..870a4ac 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 11d8403..7bc30d0 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 018ece4..fefdba3 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 3953c17..a7877b9 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 4150c4e..9fb0a8b 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 d782aba..f9497d0 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 012905c..084d596 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 93c0c04..4fbf5d8 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 506b655..f05b842 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 b3bba7b..34fce57 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 bab2e26..96fba08 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 70491d9..a9ca82f 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 6da8069..a2cffb8 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 cdce544..3f1acf7 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 cdabe5e..ded5a3d 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 7018e4e..f988a48 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 60da99b..1436fab 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 f39b893..fcdcac8 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"},