Support intllib and delete English .lua's

This commit is contained in:
MrIbby 2015-11-12 19:49:56 -08:00
parent 0c6d1ebda3
commit daad925c10
9 changed files with 19 additions and 15 deletions

View File

@ -1,2 +1,4 @@
bucket bucket
farming farming
i18n?
intllib?

View File

@ -2,6 +2,10 @@ local throwable_cake = false
-- CAKE -- -- CAKE --
local intllib = minetest.get_modpath("intllib")
local S = function(s) return s end
if intllib then S = intllib.Getter() end
local sizes = {-0.4375, -0.3125, -0.1875, -0.0625, 0.0625, 0.1875, 0.3125} local sizes = {-0.4375, -0.3125, -0.1875, -0.0625, 0.0625, 0.1875, 0.3125}
for i, size in ipairs(sizes) do for i, size in ipairs(sizes) do
@ -13,7 +17,7 @@ for i, size in ipairs(sizes) do
if slice == 0 then if slice == 0 then
name = "cake:cake" name = "cake:cake"
description = "Cake" description = S("Cake")
drop = nil drop = nil
tiles = {"cake_top.png", "cake_bottom.png", "cake_side.png"} tiles = {"cake_top.png", "cake_bottom.png", "cake_side.png"}
else else
@ -51,7 +55,7 @@ end
if minetest.get_modpath("food") == nil then if minetest.get_modpath("food") == nil then
minetest.register_craftitem("cake:sugar", { minetest.register_craftitem("cake:sugar", {
description = "Sugar", description = S("Sugar"),
inventory_image = "cake_sugar.png", inventory_image = "cake_sugar.png",
groups = {food_sugar=1} groups = {food_sugar=1}
}) })
@ -121,8 +125,4 @@ if throwable_cake then
}) })
end end
if minetest.get_modpath("i18n") then if not intllib and minetest.get_modpath("i18n") then i18n.localize_mod() end
local separator = package.config:sub(1,1)
dofile(minetest.get_modpath("i18n")..separator.."init.lua")
i18n.localize_mod()
end

2
locale/de.txt Normal file
View File

@ -0,0 +1,2 @@
Cake = Kuchen
Sugar = Zucker

View File

@ -1,4 +0,0 @@
local l10n = {}
l10n["cake:cake"] = "Cake"
l10n["cake:sugar"] = "Sugar"
return l10n

View File

@ -1,4 +0,0 @@
local l10n = {}
l10n["cake:cake"] = "Cake"
l10n["cake:sugar"] = "Sugar"
return l10n

2
locale/es.txt Normal file
View File

@ -0,0 +1,2 @@
Cake = Pastel
Sugar = Azúcar

2
locale/fr.txt Normal file
View File

@ -0,0 +1,2 @@
Cake = Gâteau
Sugar = Sucre

2
locale/pt.txt Normal file
View File

@ -0,0 +1,2 @@
Cake = Bolo
Sugar = Açúcar

2
locale/ru.txt Normal file
View File

@ -0,0 +1,2 @@
Cake = Пирожное
Sugar = Сахар