1
0
mirror of https://github.com/mt-mods/homedecor_modpack.git synced 2025-07-25 00:20:15 +02:00

Split I18N stuff into its own submod.

This commit is contained in:
Diego Martínez
2017-01-29 20:12:02 -03:00
parent 010c07f23a
commit dc7b60c11f
36 changed files with 1694 additions and 435 deletions

View File

@ -1,5 +1,5 @@
local S = homedecor.gettext
local S = homedecor_i18n.gettext
local bathroom_tile_colors = {
{ "1", S("white/grey"), "#c0c0c0:200" },

View File

@ -1,4 +1,5 @@
local S = homedecor.gettext
local S = homedecor_i18n.gettext
local toilet_sbox = {
type = "fixed",

View File

@ -1,5 +1,5 @@
local S, NS = homedecor.gettext, homedecor.ngettext
local S = homedecor_i18n.gettext
local function N_(x) return x end

View File

@ -1,5 +1,5 @@
local S = homedecor.gettext
local S = homedecor_i18n.gettext
local function N_(x) return x end

View File

@ -1,6 +1,6 @@
-- Nodes that would affect the local temperature e.g. fans, heater, A/C
local S = homedecor.gettext
local S = homedecor_i18n.gettext
homedecor.register("air_conditioner", {
description = S("Air Conditioner"),

View File

@ -2,7 +2,7 @@
--
-- Mostly my own code; overall template borrowed from game default
local S = homedecor.gettext
local S = homedecor_i18n.gettext
-- misc craftitems

View File

@ -1,12 +1,12 @@
default
unifieddyes
homedecor_i18n
building_blocks?
signs_lib?
moreblocks?
technic?
dye?
bees?
intllib?
bucket?
beds?
flowers?

View File

@ -1,6 +1,6 @@
-- Node definitions for Homedecor doors
local S = homedecor.gettext
local S = homedecor_i18n.gettext
local function N_(x) return x end

View File

@ -1,6 +1,6 @@
-- Various home electronics
local S = homedecor.gettext
local S = homedecor_i18n.gettext
homedecor.register("speaker", {
description = S("Large Stereo Speaker"),

View File

@ -1,5 +1,5 @@
local S = homedecor.gettext
local S = homedecor_i18n.gettext
local function N_(x) return x end

View File

@ -14,7 +14,7 @@ if signs_modpath then
sign_post_model = signs_lib.sign_post_model.nodebox
end
local S = homedecor.gettext
local S = homedecor_i18n.gettext
local function N_(x) return x end

View File

@ -1,4 +1,5 @@
local S = homedecor.gettext
local S = homedecor_i18n.gettext
local table_colors = {
{ "", S("Table"), homedecor.plain_wood },

View File

@ -1,5 +1,5 @@
local S = homedecor.gettext
local S = homedecor_i18n.gettext
homedecor.register("bars", {
description = S("Bars"),

View File

@ -1,6 +1,6 @@
-- This code supplies an oven/stove. Basically it's just a copy of the default furnace with different textures.
local S = homedecor.gettext
local S = homedecor_i18n.gettext
local function swap_node(pos, name)
local node = minetest.get_node(pos)

View File

@ -1,4 +1,5 @@
local S = homedecor.gettext
local S = homedecor_i18n.gettext
local default_can_dig = function(pos,player)
local meta = minetest.get_meta(pos)

View File

@ -9,15 +9,11 @@
local modpath = minetest.get_modpath("homedecor")
-- Load support for intllib.
local S, NS = dofile(modpath.."/intllib.lua")
local S = homedecor_i18n.gettext
homedecor = {
modpath = modpath,
gettext = S,
ngettext = NS,
-- infinite stacks
expect_infinite_stacks = minetest.setting_getbool("creative_mode") and not minetest.get_modpath("unified_inventory")
}

View File

@ -1,45 +0,0 @@
-- Fallback functions for when `intllib` is not installed.
-- Code released under Unlicense <http://unlicense.org>.
-- Get the latest version of this file at:
-- https://raw.githubusercontent.com/minetest-mods/intllib/master/lib/intllib.lua
local function format(str, ...)
local args = { ... }
local function repl(escape, open, num, close)
if escape == "" then
local replacement = tostring(args[tonumber(num)])
if open == "" then
replacement = replacement..close
end
return replacement
else
return "@"..open..num..close
end
end
return (str:gsub("(@?)@(%(?)(%d+)(%)?)", repl))
end
local gettext, ngettext
if minetest.get_modpath("intllib") then
if intllib.make_gettext_pair then
-- New method using gettext.
gettext, ngettext = intllib.make_gettext_pair()
else
-- Old method using text files.
gettext = intllib.Getter()
end
end
-- Fill in missing functions.
gettext = gettext or function(msgid, ...)
return format(msgid, ...)
end
ngettext = ngettext or function(msgid, msgid_plural, n, ...)
return format(n==1 and msgid or msgid_plural, ...)
end
return gettext, ngettext

View File

@ -1,6 +1,6 @@
-- This file supplies refrigerators
local S = homedecor.gettext
local S = homedecor_i18n.gettext
local function N_(x) return x end

View File

@ -1,6 +1,6 @@
-- This file supplies Kitchen cabinets and kitchen sink
local S = homedecor.gettext
local S = homedecor_i18n.gettext
local cabinet_sides = "(default_wood.png^[transformR90)^homedecor_kitchen_cabinet_bevel.png"
local cabinet_bottom = "(default_wood.png^[colorize:#000000:100)^(homedecor_kitchen_cabinet_bevel.png^[colorize:#46321580)"

View File

@ -2,7 +2,7 @@
local dirs2 = { 9, 18, 7, 12 }
local S = homedecor.gettext
local S = homedecor_i18n.gettext
local function N_(x) return x end

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
local S = homedecor.gettext
local S = homedecor_i18n.gettext
local function N_(x) return x end

View File

@ -1,4 +1,5 @@
local S = homedecor.gettext
local S = homedecor_i18n.gettext
homedecor.register("filing_cabinet", {
description = S("Filing cabinet"),

View File

@ -1,5 +1,5 @@
local S = homedecor.gettext
local S = homedecor_i18n.gettext
local function N_(x) return x end

View File

@ -1,6 +1,6 @@
-- Various kinds of window shutters
local S = homedecor.gettext
local S = homedecor_i18n.gettext
local shutters = {
{"oak", S("unpainted oak"), "bf8a51" },

View File

@ -1,4 +1,5 @@
local S = homedecor.gettext
local S = homedecor_i18n.gettext
-- Various kinds of tables

View File

@ -1,20 +0,0 @@
#! /bin/bash
# To create a new translation:
# msginit --locale=ll_CC -o locale/ll_CC.po -i locale/template.pot
cd "$(dirname "${BASH_SOURCE[0]}")/..";
# Extract translatable strings.
xgettext --from-code=UTF-8 \
--keyword=S \
--keyword=NS:1,2 \
--keyword=N_ \
-o locale/template.pot \
$(find .. -name '*.lua')
# Update translations.
find locale -name '*.po' | while read -r file; do
echo $file
msgmerge --update $file locale/template.pot;
done

View File

@ -1,5 +1,5 @@
local S = homedecor.gettext
local S = homedecor_i18n.gettext
local function N_(x) return x end