mirror of
https://github.com/mt-mods/homedecor_modpack.git
synced 2024-12-23 08:20:21 +01:00
Use a single `intllib.Getter' for all the texts.
Just a minimal code reduction, but big reduction in code duplication. This could help if in the future, support for different "internationalization" mods will be added, or in case Minetest supports I18N/L10N internally in the engine.
This commit is contained in:
parent
ebe8adf855
commit
10cef3dda1
@ -6,14 +6,7 @@
|
|||||||
-- License: GPL
|
-- License: GPL
|
||||||
--
|
--
|
||||||
|
|
||||||
-- Boilerplate to support localized strings if intllib mod is installed.
|
local S = homedecor.gettext
|
||||||
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
|
|
||||||
|
|
||||||
-- misc stuff :D
|
-- misc stuff :D
|
||||||
|
|
||||||
|
@ -1,12 +1,5 @@
|
|||||||
|
|
||||||
-- Boilerplate to support localized strings if intllib mod is installed.
|
local S = homedecor.gettext
|
||||||
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
|
|
||||||
|
|
||||||
homedecor.door_models = {
|
homedecor.door_models = {
|
||||||
{
|
{
|
||||||
|
@ -1,13 +1,6 @@
|
|||||||
-- Node definitions for Homedecor doors
|
-- Node definitions for Homedecor doors
|
||||||
|
|
||||||
-- Boilerplate to support localized strings if intllib mod is installed.
|
local S = homedecor.gettext
|
||||||
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
|
|
||||||
|
|
||||||
-- doors
|
-- doors
|
||||||
|
|
||||||
|
@ -1,13 +1,6 @@
|
|||||||
-- Various home electronics
|
-- Various home electronics
|
||||||
|
|
||||||
-- Boilerplate to support localized strings if intllib mod is installed.
|
local S = homedecor.gettext
|
||||||
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
|
|
||||||
|
|
||||||
minetest.register_node('homedecor:speaker', {
|
minetest.register_node('homedecor:speaker', {
|
||||||
description = S("Large Stereo Speaker"),
|
description = S("Large Stereo Speaker"),
|
||||||
|
@ -1,13 +1,6 @@
|
|||||||
-- This file adds fences of various types
|
-- This file adds fences of various types
|
||||||
|
|
||||||
-- Boilerplate to support localized strings if intllib mod is installed.
|
local S = homedecor.gettext
|
||||||
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
|
|
||||||
|
|
||||||
minetest.register_node("homedecor:fence_brass", {
|
minetest.register_node("homedecor:fence_brass", {
|
||||||
description = S("Brass Fence/railing"),
|
description = S("Brass Fence/railing"),
|
||||||
|
@ -1,13 +1,6 @@
|
|||||||
-- This code supplies an oven/stove. Basically it's just a copy of the default furnace with different textures.
|
-- 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 = homedecor.gettext
|
||||||
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 function hacky_swap_node(pos,name)
|
local function hacky_swap_node(pos,name)
|
||||||
local node = minetest.get_node(pos)
|
local node = minetest.get_node(pos)
|
||||||
|
1
init.lua
1
init.lua
@ -27,6 +27,7 @@ if homedecor.intllib_modpath then
|
|||||||
else
|
else
|
||||||
S = function ( s ) return s end
|
S = function ( s ) return s end
|
||||||
end
|
end
|
||||||
|
homedecor.gettext = S
|
||||||
|
|
||||||
local dbg = function(s)
|
local dbg = function(s)
|
||||||
if homedecor.debug == 1 then
|
if homedecor.debug == 1 then
|
||||||
|
@ -1,13 +1,6 @@
|
|||||||
-- This file supplies Kitchen cabinets and kitchen sink
|
-- This file supplies Kitchen cabinets and kitchen sink
|
||||||
|
|
||||||
-- Boilerplate to support localized strings if intllib mod is installed.
|
local S = homedecor.gettext
|
||||||
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
|
|
||||||
|
|
||||||
minetest.register_node('homedecor:kitchen_cabinet', {
|
minetest.register_node('homedecor:kitchen_cabinet', {
|
||||||
description = S("Kitchen Cabinet"),
|
description = S("Kitchen Cabinet"),
|
||||||
|
@ -1,14 +1,7 @@
|
|||||||
|
|
||||||
-- This file supplies glowlights
|
-- This file supplies glowlights
|
||||||
|
|
||||||
-- Boilerplate to support localized strings if intllib mod is installed.
|
local S = homedecor.gettext
|
||||||
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 colors = {"yellow","white"}
|
local colors = {"yellow","white"}
|
||||||
|
|
||||||
|
@ -7,14 +7,7 @@
|
|||||||
-- License: LGPL
|
-- License: LGPL
|
||||||
--
|
--
|
||||||
|
|
||||||
-- Boilerplate to support localized strings if intllib mod is installed.
|
local S = homedecor.gettext
|
||||||
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
|
|
||||||
|
|
||||||
--[[
|
--[[
|
||||||
| create_locked ( name, infotext )
|
| create_locked ( name, infotext )
|
||||||
|
@ -1,13 +1,6 @@
|
|||||||
-- Various misc. nodes
|
-- Various misc. nodes
|
||||||
|
|
||||||
-- Boilerplate to support localized strings if intllib mod is installed.
|
local S = homedecor.gettext
|
||||||
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
|
|
||||||
|
|
||||||
minetest.register_node('homedecor:ceiling_paint', {
|
minetest.register_node('homedecor:ceiling_paint', {
|
||||||
description = S("Textured Ceiling Paint"),
|
description = S("Textured Ceiling Paint"),
|
||||||
|
@ -1,13 +1,6 @@
|
|||||||
-- This file supplies nightstands
|
-- This file supplies nightstands
|
||||||
|
|
||||||
-- Boilerplate to support localized strings if intllib mod is installed.
|
local S = homedecor.gettext
|
||||||
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
|
|
||||||
|
|
||||||
minetest.register_node('homedecor:nightstand_oak_one_drawer', {
|
minetest.register_node('homedecor:nightstand_oak_one_drawer', {
|
||||||
drawtype = "nodebox",
|
drawtype = "nodebox",
|
||||||
|
@ -1,10 +1,5 @@
|
|||||||
local S
|
|
||||||
if homedecor.intllib_modpath then
|
local S = homedecor.gettext
|
||||||
dofile(homedecor.intllib_modpath.."/intllib.lua")
|
|
||||||
S = intllib.Getter(minetest.get_current_modname())
|
|
||||||
else
|
|
||||||
S = function ( s ) return s end
|
|
||||||
end
|
|
||||||
|
|
||||||
function homedecor:node_is_owned(pos, placer)
|
function homedecor:node_is_owned(pos, placer)
|
||||||
local ownername = false
|
local ownername = false
|
||||||
|
@ -1,13 +1,6 @@
|
|||||||
-- This file supplies refrigerators
|
-- This file supplies refrigerators
|
||||||
|
|
||||||
-- Boilerplate to support localized strings if intllib mod is installed.
|
local S = homedecor.gettext
|
||||||
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
|
|
||||||
|
|
||||||
minetest.register_node('homedecor:refrigerator', {
|
minetest.register_node('homedecor:refrigerator', {
|
||||||
drawtype = "nodebox",
|
drawtype = "nodebox",
|
||||||
|
@ -1,13 +1,6 @@
|
|||||||
-- Various kidns of shingles
|
-- Various kidns of shingles
|
||||||
|
|
||||||
-- Boilerplate to support localized strings if intllib mod is installed.
|
local S = homedecor.gettext
|
||||||
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
|
|
||||||
|
|
||||||
minetest.register_node("homedecor:skylight", {
|
minetest.register_node("homedecor:skylight", {
|
||||||
description = S("Glass Skylight"),
|
description = S("Glass Skylight"),
|
||||||
|
@ -1,13 +1,6 @@
|
|||||||
-- Various kinds of window shutters
|
-- Various kinds of window shutters
|
||||||
|
|
||||||
-- Boilerplate to support localized strings if intllib mod is installed.
|
local S = homedecor.gettext
|
||||||
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 shutters = {
|
local shutters = {
|
||||||
{"oak", "Unpainted oak"},
|
{"oak", "Unpainted oak"},
|
||||||
|
@ -1,12 +1,5 @@
|
|||||||
|
|
||||||
-- Boilerplate to support localized strings if intllib mod is installed.
|
local S = homedecor.gettext
|
||||||
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
|
|
||||||
|
|
||||||
-- CONSTANTS
|
-- CONSTANTS
|
||||||
|
|
||||||
|
@ -1,13 +1,6 @@
|
|||||||
-- Various kinds of shingles
|
-- Various kinds of shingles
|
||||||
|
|
||||||
-- Boilerplate to support localized strings if intllib mod is installed.
|
local S = homedecor.gettext
|
||||||
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
|
|
||||||
|
|
||||||
-- Corner shingle nodes, courtesy Bas080
|
-- Corner shingle nodes, courtesy Bas080
|
||||||
|
|
||||||
|
@ -1,13 +1,6 @@
|
|||||||
-- Various kinds of tables
|
-- Various kinds of tables
|
||||||
|
|
||||||
-- Boilerplate to support localized strings if intllib mod is installed.
|
local S = homedecor.gettext
|
||||||
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
|
|
||||||
|
|
||||||
materials = {
|
materials = {
|
||||||
{"glass","Glass"},
|
{"glass","Glass"},
|
||||||
|
Loading…
Reference in New Issue
Block a user