summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--depends.txt3
-rw-r--r--init.lua45
-rw-r--r--locale/de.txt14
-rw-r--r--locale/template.txt12
4 files changed, 61 insertions, 13 deletions
diff --git a/depends.txt b/depends.txt
index 4fbb8e1..657056a 100644
--- a/depends.txt
+++ b/depends.txt
@@ -1,2 +1,3 @@
default
-farming \ No newline at end of file
+farming
+intllib?
diff --git a/init.lua b/init.lua
index a9b0d8f..1ee755c 100644
--- a/init.lua
+++ b/init.lua
@@ -1,7 +1,28 @@
+-- Intllib
+local S
+if minetest.get_modpath("intllib") then
+ S = intllib.Getter()
+else
+ S = function(s, a, ...)
+ if a == nil then
+ return s
+ end
+ a = {a, ...}
+ return s:gsub("(@?)@(%(?)(%d+)(%)?)",
+ function(e, o, n, c)
+ if e == ""then
+ return a[tonumber(n)] .. (o == "" and c or "")
+ else
+ return "@" .. o .. n .. c
+ end
+ end)
+ end
+end
+
-- glass of wine
minetest.register_node("wine:glass_wine", {
- description = "Glass of Wine",
+ description = S("Glass of Wine"),
drawtype = "plantlike",
visual_scale = 0.8,
tiles = {"wine_glass.png"},
@@ -22,7 +43,7 @@ minetest.register_node("wine:glass_wine", {
-- bottle of wine
minetest.register_node("wine:bottle_wine", {
- description = "Bottle of Wine",
+ description = S("Bottle of Wine"),
drawtype = "plantlike",
tiles = {"wine_bottle.png"},
inventory_image = "wine_bottle.png",
@@ -54,7 +75,7 @@ minetest.register_craft({
-- glass of beer (thanks to RiverKpocc @ deviantart.com for image)
minetest.register_node("wine:glass_beer", {
- description = "Beer",
+ description = S("Beer"),
drawtype = "torchlike", --"plantlike",
visual_scale = 0.8,
tiles = {"wine_beer_glass.png"},
@@ -75,7 +96,7 @@ minetest.register_node("wine:glass_beer", {
-- glass of honey mead
minetest.register_node("wine:glass_mead", {
- description = "Honey-Mead",
+ description = S("Honey-Mead"),
drawtype = "plantlike",
visual_scale = 0.8,
tiles = {"wine_mead_glass.png"},
@@ -96,7 +117,7 @@ minetest.register_node("wine:glass_mead", {
-- glass of apple cider
minetest.register_node("wine:glass_cider", {
- description = "Apple Cider",
+ description = S("Apple Cider"),
drawtype = "plantlike",
visual_scale = 0.8,
tiles = {"wine_cider_glass.png"},
@@ -127,7 +148,7 @@ winebarrel_formspec = "size[8,9]"
.. "listring[current_player;main]"
minetest.register_node("wine:wine_barrel", {
- description = "Fermenting Barrel",
+ description = S("Fermenting Barrel"),
tiles = {"wine_barrel.png" },
drawtype = "mesh",
mesh = "wine_barrel.obj",
@@ -139,7 +160,7 @@ minetest.register_node("wine:wine_barrel", {
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_string("formspec", winebarrel_formspec)
- meta:set_string("infotext", "Fermenting Barrel")
+ meta:set_string("infotext", S("Fermenting Barrel"))
meta:set_float("status", 0.0)
local inv = meta:get_inventory()
inv:set_size("src", 1)
@@ -242,7 +263,7 @@ minetest.register_abm({
or not inv:room_for_item("dst", "wine:glass_beer")
or not inv:room_for_item("dst", "wine:glass_cider")
or not inv:room_for_item("dst", "wine:glass_mead") then
- meta:set_string("infotext", "Fermenting Barrel (FULL)")
+ meta:set_string("infotext", S("Fermenting Barrel (FULL)"))
return
end
@@ -253,7 +274,7 @@ minetest.register_abm({
-- fermenting (change status)
if status < 100 then
- meta:set_string("infotext", "Fermenting Barrel (" .. status .. "% Done)")
+ meta:set_string("infotext", S("Fermenting Barrel (@1% Done)", status))
meta:set_float("status", status + 5)
else
@@ -289,14 +310,14 @@ minetest.register_abm({
if inv:is_empty("src") then
meta:set_float("status", 0.0)
- meta:set_string("infotext", "Fermenting Barrel")
+ meta:set_string("infotext", S("Fermenting Barrel"))
end
end
else
- meta:set_string("infotext", "Fermenting Barrel")
+ meta:set_string("infotext", S("Fermenting Barrel"))
end
end,
})
-print ("[MOD] Wine mod loaded")
+print (S("[MOD] Wine loaded"))
diff --git a/locale/de.txt b/locale/de.txt
new file mode 100644
index 0000000..74e9f27
--- /dev/null
+++ b/locale/de.txt
@@ -0,0 +1,14 @@
+# German Translation for wine mod
+# Deutsche Übersetzung der wine Mod
+# last update: 2016/May/26
+# Author: Xanthin
+
+Glass of Wine = Glas Wein
+Bottle of Wine = Flasche Wein
+Beer = Bier
+Honey-Mead = Honigwein
+Apple Cider = Apfelwein
+Fermenting Barrel = Gärfass
+Fermenting Barrel (FULL) = Gärfass (VOLL)
+Fermenting Barrel (@1% Done) = Gärfass (@1% erledigt)
+[MOD] Wine loaded = [MOD] Wine geladen \ No newline at end of file
diff --git a/locale/template.txt b/locale/template.txt
new file mode 100644
index 0000000..bf4f6c3
--- /dev/null
+++ b/locale/template.txt
@@ -0,0 +1,12 @@
+# Template for translations of wine mod
+# last update: 2016/May/26
+
+Glass of Wine =
+Bottle of Wine =
+Beer =
+Honey-Mead =
+Apple Cider =
+Fermenting Barrel =
+Fermenting Barrel (FULL) =
+Fermenting Barrel (@1% Done) =
+[MOD] Wine loaded = \ No newline at end of file