diff --git a/sunos_compost/LICENSE.txt b/sociedades_compost/LICENSE.txt similarity index 100% rename from sunos_compost/LICENSE.txt rename to sociedades_compost/LICENSE.txt diff --git a/sunos_compost/README.md b/sociedades_compost/README.md similarity index 93% rename from sunos_compost/README.md rename to sociedades_compost/README.md index ff903cd..54b60e4 100644 --- a/sunos_compost/README.md +++ b/sociedades_compost/README.md @@ -37,6 +37,12 @@ If there is nothing in the bin, it looks empty when viewed from top (node "compost:wood_barrel_empty"). If there's anything in it (inputs or soil), it looks full of dirt (node "compost:wood_barrel"). +Internationalization +-------------------- +The mod is compatible with intllib. Currently available translations: +* Romanian +* Russian + License ------- see LICENSE.txt diff --git a/sunos_compost/depends.txt b/sociedades_compost/depends.txt similarity index 62% rename from sunos_compost/depends.txt rename to sociedades_compost/depends.txt index 3296b1e..6b85902 100644 --- a/sunos_compost/depends.txt +++ b/sociedades_compost/depends.txt @@ -1,2 +1,3 @@ default stairs +intllib? diff --git a/sunos_compost/description.txt b/sociedades_compost/description.txt similarity index 100% rename from sunos_compost/description.txt rename to sociedades_compost/description.txt diff --git a/sunos_compost/init.lua b/sociedades_compost/init.lua similarity index 92% rename from sunos_compost/init.lua rename to sociedades_compost/init.lua index 278bac9..b87d32d 100644 --- a/sunos_compost/init.lua +++ b/sociedades_compost/init.lua @@ -9,9 +9,24 @@ -- Checks if the original mod is active if minetest.get_modpath("compost") then return end + minetest.log('action', 'MOD: Compost loading...') compost_version = '0.0.1' +local i18n --internationalization + if minetest.get_modpath("intllib") then +minetest.log('action', 'intllib loaded') + i18n = intllib.Getter() + else + i18n = function(s,a,...) + a={a,...} + local v = s:gsub("@(%d+)", function(n) + return a[tonumber(n)] + end) + return v + end +end + compost = {} compost.compostable_groups = {'flora', 'leaves', 'flower'} compost.compostable_nodes = { @@ -111,12 +126,12 @@ local function update_timer(pos) if not timer:is_started() and count >= 8 then timer:start(30) meta:set_int('progress', 0) - meta:set_string('infotext', 'progress: 0%') + meta:set_string('infotext', i18n('progress: @1%', '0')) return end if timer:is_started() and count < 8 then timer:stop() - meta:set_string('infotext', 'Empty composting bin.\nTo get compost, add some organic matter.') + meta:set_string('infotext', i18n('To start composting, place some organic matter inside.')) meta:set_int('progress', 0) end end @@ -155,11 +170,11 @@ local function on_timer(pos) meta:set_int('progress', progress) end if count_input(pos) >= 8 then - meta:set_string('infotext', 'progress: ' .. progress .. '%') + meta:set_string('infotext', i18n('progress: @1%', progress)) return true else timer:stop() - meta:set_string('infotext', 'Empty composting bin.\nTo get compost, add some organic matter.') + meta:set_string('infotext', i18n('To start composting, place some organic matter inside.')) meta:set_int('progress', 0) return false end @@ -170,7 +185,7 @@ local function on_construct(pos) local inv = meta:get_inventory() inv:set_size('src', 8) inv:set_size('dst', 1) - meta:set_string('infotext','Empty composting bin.\nTo get compost, add some organic matter.') + meta:set_string('infotext', i18n('To start composting, place some organic matter inside.')) meta:set_int('progress', 0) end @@ -250,7 +265,7 @@ local function on_punch(pos, node, player, pointed_thing) end minetest.register_node(":compost:wood_barrel_empty", { - description = "Empty Compost Bin", + description = i18n('Empty Compost Bin'), tiles = { "default_wood.png", }, @@ -283,7 +298,7 @@ minetest.register_node(":compost:wood_barrel_empty", { }) minetest.register_node(":compost:wood_barrel", { - description = "Compost Bin", + description = i18n('Compost Bin'), tiles = { "default_wood.png^compost_compost.png", "default_wood.png", diff --git a/sociedades_compost/locale/pt.txt b/sociedades_compost/locale/pt.txt new file mode 100644 index 0000000..56a22e8 --- /dev/null +++ b/sociedades_compost/locale/pt.txt @@ -0,0 +1,6 @@ +# Translations by BrunoMine, 2017 + +Compost Bin = Silo de Compostagem +Empty Compost Bin = Silo de Compostagem Vazio +To start composting, place some organic matter inside. = Para iniciar a compostagem, coloque alguma materia organica dentro. +progress: @1% = progresso: @1% diff --git a/sociedades_compost/locale/ro.txt b/sociedades_compost/locale/ro.txt new file mode 100644 index 0000000..5888466 --- /dev/null +++ b/sociedades_compost/locale/ro.txt @@ -0,0 +1,4 @@ +Compost Bin = Cutie de compost +Empty Compost Bin = Cutie de compost goală +To start composting, place some organic matter inside. = Pentru a începe compostarea, adaugă materie organică +progress: @1% = progres: @1% diff --git a/sociedades_compost/locale/ru.txt b/sociedades_compost/locale/ru.txt new file mode 100644 index 0000000..967d3f8 --- /dev/null +++ b/sociedades_compost/locale/ru.txt @@ -0,0 +1,4 @@ +Compost Bin = Компостный ящик +Empty Compost Bin = Пустой компостный ящик +To start composting, place some organic matter inside. = Чтобы начать компостирование, добавьте органику внутрь +progress: @1% = прогресс: @1% diff --git a/sociedades_compost/locale/template.txt b/sociedades_compost/locale/template.txt new file mode 100644 index 0000000..dcfe858 --- /dev/null +++ b/sociedades_compost/locale/template.txt @@ -0,0 +1,4 @@ +Compost Bin = +Empty Compost Bin = +To start composting, place some organic matter inside. = +progress: @1% = diff --git a/sunos_compost/screenshot.png b/sociedades_compost/screenshot.png similarity index 100% rename from sunos_compost/screenshot.png rename to sociedades_compost/screenshot.png diff --git a/sunos_compost/textures/compost_compost.png b/sociedades_compost/textures/compost_compost.png similarity index 100% rename from sunos_compost/textures/compost_compost.png rename to sociedades_compost/textures/compost_compost.png diff --git a/sunos/depends.txt b/sunos/depends.txt index 444fc16..073fbf2 100644 --- a/sunos/depends.txt +++ b/sunos/depends.txt @@ -13,4 +13,4 @@ xpanes stairs doors farming -sunos_compost +sociedades_compost diff --git a/sunos_compost/.gitignore b/sunos_compost/.gitignore deleted file mode 100644 index ce3cbfc..0000000 --- a/sunos_compost/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -# Backup files -*~