diff --git a/depends.txt b/depends.txt index 84893d5..18b7624 100644 --- a/depends.txt +++ b/depends.txt @@ -1,2 +1,4 @@ bucket farming +i18n? +intllib? diff --git a/init.lua b/init.lua index 8653a1d..2fea84f 100644 --- a/init.lua +++ b/init.lua @@ -2,6 +2,10 @@ local throwable_cake = false -- 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} for i, size in ipairs(sizes) do @@ -13,7 +17,7 @@ for i, size in ipairs(sizes) do if slice == 0 then name = "cake:cake" - description = "Cake" + description = S("Cake") drop = nil tiles = {"cake_top.png", "cake_bottom.png", "cake_side.png"} else @@ -51,7 +55,7 @@ end if minetest.get_modpath("food") == nil then minetest.register_craftitem("cake:sugar", { - description = "Sugar", + description = S("Sugar"), inventory_image = "cake_sugar.png", groups = {food_sugar=1} }) @@ -121,8 +125,4 @@ if throwable_cake then }) end -if minetest.get_modpath("i18n") then - local separator = package.config:sub(1,1) - dofile(minetest.get_modpath("i18n")..separator.."init.lua") - i18n.localize_mod() -end +if not intllib and minetest.get_modpath("i18n") then i18n.localize_mod() end diff --git a/locale/de.txt b/locale/de.txt new file mode 100644 index 0000000..a905b2a --- /dev/null +++ b/locale/de.txt @@ -0,0 +1,2 @@ +Cake = Kuchen +Sugar = Zucker diff --git a/locale/en_GB.lua b/locale/en_GB.lua deleted file mode 100644 index 21409c4..0000000 --- a/locale/en_GB.lua +++ /dev/null @@ -1,4 +0,0 @@ -local l10n = {} -l10n["cake:cake"] = "Cake" -l10n["cake:sugar"] = "Sugar" -return l10n diff --git a/locale/en_US.lua b/locale/en_US.lua deleted file mode 100644 index 21409c4..0000000 --- a/locale/en_US.lua +++ /dev/null @@ -1,4 +0,0 @@ -local l10n = {} -l10n["cake:cake"] = "Cake" -l10n["cake:sugar"] = "Sugar" -return l10n diff --git a/locale/es.txt b/locale/es.txt new file mode 100644 index 0000000..d0271ae --- /dev/null +++ b/locale/es.txt @@ -0,0 +1,2 @@ +Cake = Pastel +Sugar = Azúcar diff --git a/locale/fr.txt b/locale/fr.txt new file mode 100644 index 0000000..557bfad --- /dev/null +++ b/locale/fr.txt @@ -0,0 +1,2 @@ +Cake = Gâteau +Sugar = Sucre diff --git a/locale/pt.txt b/locale/pt.txt new file mode 100644 index 0000000..b10fdea --- /dev/null +++ b/locale/pt.txt @@ -0,0 +1,2 @@ +Cake = Bolo +Sugar = Açúcar diff --git a/locale/ru.txt b/locale/ru.txt new file mode 100644 index 0000000..7274378 --- /dev/null +++ b/locale/ru.txt @@ -0,0 +1,2 @@ +Cake = Пирожное +Sugar = Сахар