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:
kaeza 2013-10-21 22:31:54 -02:00
parent ebe8adf855
commit 10cef3dda1
19 changed files with 20 additions and 143 deletions

View File

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

View File

@ -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 = {
{

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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"}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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