From 598426a17ea87e2ed028219fc449b3fa091a9133 Mon Sep 17 00:00:00 2001 From: Xanthin Date: Wed, 12 Mar 2014 16:45:08 +0100 Subject: [PATCH] Added intllib support Added german translation --- barn/depends.txt | 1 + barn/init.lua | 16 +++++++++++++--- barn/locale/de.txt | 4 ++++ barn/locale/template.txt | 4 ++++ mobf/depends.txt | 3 ++- mobf/inventory.lua | 24 ++++++++++++++++-------- mobf/locale/de.txt | 12 ++++++++++++ mobf/locale/template.txt | 12 ++++++++++++ mobf/path.lua | 14 ++++++++++++-- trap/depends.txt | 1 + trap/init.lua | 15 ++++++++++++--- trap/locale/de.txt | 4 ++++ trap/locale/template.txt | 4 ++++ 13 files changed, 97 insertions(+), 17 deletions(-) create mode 100644 barn/locale/de.txt create mode 100644 barn/locale/template.txt create mode 100644 mobf/locale/de.txt create mode 100644 mobf/locale/template.txt create mode 100644 trap/locale/de.txt create mode 100644 trap/locale/template.txt diff --git a/barn/depends.txt b/barn/depends.txt index 1597aff..7d85f70 100644 --- a/barn/depends.txt +++ b/barn/depends.txt @@ -1,2 +1,3 @@ default mobf +intllib? diff --git a/barn/init.lua b/barn/init.lua index 057da33..dc6ee35 100644 --- a/barn/init.lua +++ b/barn/init.lua @@ -13,6 +13,16 @@ -- -- Contact sapier a t gmx net ------------------------------------------------------------------------------- + +-- Boilerplate to support localized strings if intllib mod is installed. +local S +if (minetest.get_modpath("intllib")) then + dofile(minetest.get_modpath("intllib").."/intllib.lua") + S = intllib.Getter(minetest.get_current_modname()) +else + S = function ( s ) return s end +end + minetest.log("action","MOD: barn mod loading ...") local version = "0.0.11" @@ -31,7 +41,7 @@ barn_breedpairs_small = { dofile (modpath .. "/model.lua") minetest.register_craftitem("barn:barn_empty", { - description = "Barn to breed animals", + description = S("Barn to breed animals"), image = minetest.inventorycube("barn_3d_empty_top.png","barn_3d_empty_side.png","barn_3d_empty_side.png"), on_place = function(item, placer, pointed_thing) if pointed_thing.type == "node" then @@ -47,7 +57,7 @@ minetest.register_craftitem("barn:barn_empty", { }) minetest.register_craftitem("barn:barn_small_empty", { - description = "Barn to breed small animals", + description = S("Barn to breed small animals"), image = "barn_small.png", on_place = function(item, placer, pointed_thing) if pointed_thing.type == "node" then @@ -362,4 +372,4 @@ minetest.register_entity(":barn:barn_small_empty_ent", }) -minetest.log("action","MOD: barn mod version " .. version .. " loaded") \ No newline at end of file +minetest.log("action","MOD: barn mod version " .. version .. " loaded") diff --git a/barn/locale/de.txt b/barn/locale/de.txt new file mode 100644 index 0000000..983ddd3 --- /dev/null +++ b/barn/locale/de.txt @@ -0,0 +1,4 @@ +# Translation by Xanthin + +Barn to breed animals = Raufe um Tiere zu zuechten +Barn to breed small animals = Raufe um kleine Tiere zu zuechten diff --git a/barn/locale/template.txt b/barn/locale/template.txt new file mode 100644 index 0000000..a9400c3 --- /dev/null +++ b/barn/locale/template.txt @@ -0,0 +1,4 @@ +# Template + +Barn to breed animals = +Barn to breed small animals = diff --git a/mobf/depends.txt b/mobf/depends.txt index 9489dc2..1f48f09 100644 --- a/mobf/depends.txt +++ b/mobf/depends.txt @@ -1,3 +1,4 @@ default animalmaterials -adv_spawning \ No newline at end of file +adv_spawning +intllib? diff --git a/mobf/inventory.lua b/mobf/inventory.lua index 3186c17..9b98b3d 100644 --- a/mobf/inventory.lua +++ b/mobf/inventory.lua @@ -18,6 +18,14 @@ -- -- Contact sapier a t gmx net ------------------------------------------------------------------------------- +-- Boilerplate to support localized strings if intllib mod is installed. +local S +if intllib then + S = intllib.Getter() +else + S = function(s) return s end +end +------------------------------------------------------------------------------- mobf_assert_backtrace(mob_inventory == nil) --! @class mob_inventory --! @brief inventory handling for trader like mobs @@ -392,21 +400,21 @@ function mob_inventory.init_trader_inventory(entity) .. tostring(entity) .. "\"" ) local trader_formspec = "size[8,10;]" .. - "label[2,0;Trader " .. tradername .. " Inventory]" .. - "label[0,1;Selling:]" .. + "label[2,0;"..S("Trader %s Inventory"):format(tradername).."]" .. + "label[0,1;"..S("Selling:").."]" .. "list[detached:" .. unique_entity_id .. ";goods;0,1.5;8,2;]" .. - "label[0,4.0;Selection]" .. + "label[0,4.0;"..S("Selection").."]" .. "list[detached:" .. unique_entity_id .. ";selection;0,4.5;1,1;]" .. "label[1.25,4.75;-->]" .. - "label[2,4.0;Price]" .. + "label[2,4.0;"..S("Price").."]" .. "list[detached:" .. unique_entity_id .. ";price_1;2,4.5;1,1;]" .. - "label[3,4.0;or]" .. + "label[3,4.0;"..S("or").."]" .. "list[detached:" .. unique_entity_id .. ";price_2;3,4.5;1,1;]" .. "label[4.25,4.75;-->]" .. - "label[5,4.0;Pay]" .. + "label[5,4.0;"..S("Pay").."]" .. "list[detached:" .. unique_entity_id .. ";pay;5,4.5;1,1;]" .. "label[6.25,4.75;-->]" .. - "label[6.75,4.0;Takeaway]" .. + "label[6.75,4.0;"..S("Takeaway").."]" .. "list[detached:" .. unique_entity_id .. ";takeaway;7,4.5;1,1;]" .. "list[current_player;main;0,6;8,4;]" @@ -618,4 +626,4 @@ function mob_inventory.add_goods(entity,trader_inventory) goods_to_add[i][1]) end -end \ No newline at end of file +end diff --git a/mobf/locale/de.txt b/mobf/locale/de.txt new file mode 100644 index 0000000..2599c69 --- /dev/null +++ b/mobf/locale/de.txt @@ -0,0 +1,12 @@ +# Translation by Xanthin + +Path marker tool = Pfadmarkierer + +###Inventory.lua### +Trader %s Inventory = Haendler %s Waren +Selling: = Zu verkaufen: +Selection = Auswahl +Price = Preis +or = oder +Pay = Bezahlen +Takeaway = Wegnehmen diff --git a/mobf/locale/template.txt b/mobf/locale/template.txt new file mode 100644 index 0000000..6835aaf --- /dev/null +++ b/mobf/locale/template.txt @@ -0,0 +1,12 @@ +# Template + +Path marker tool = + +###Inventory.lua### +Trader %s Inventory = +Selling: = +Selection = +Price = +or = +Pay = +Takeaway = diff --git a/mobf/path.lua b/mobf/path.lua index b6c44a0..6c6c1df 100644 --- a/mobf/path.lua +++ b/mobf/path.lua @@ -12,6 +12,16 @@ --! @date 2013-02-09 -- -- Contact sapier a t gmx net + +-- Boilerplate to support localized strings if intllib mod is installed. +local S +if (minetest.get_modpath("intllib")) then + dofile(minetest.get_modpath("intllib").."/intllib.lua") + S = intllib.Getter(minetest.get_current_modname()) +else + S = function ( s ) return s end +end + ------------------------------------------------------------------------------- mobf_assert_backtrace(mobf_path == nil) mobf_path = {} @@ -59,7 +69,7 @@ function mobf_path.init() }) minetest.register_craftitem(":mobf:path_marker", { - description = "Path marker tool", + description = S("Path marker tool"), image = "mobf_path_marker_item.png", on_place = function(item, placer, pointed_thing) if pointed_thing.type == "node" then @@ -594,4 +604,4 @@ function mobf_path.getpoints(pathowner,pathname) end return mobf_rtd.path_data.users[pathowner].paths[pathname].points -end \ No newline at end of file +end diff --git a/trap/depends.txt b/trap/depends.txt index 6c415a0..495606e 100644 --- a/trap/depends.txt +++ b/trap/depends.txt @@ -2,3 +2,4 @@ default animal_vombie mobf animalmaterials +intllib? diff --git a/trap/init.lua b/trap/init.lua index c8bd33c..a45e84e 100644 --- a/trap/init.lua +++ b/trap/init.lua @@ -1,9 +1,18 @@ +-- Boilerplate to support localized strings if intllib mod is installed. +local S +if (minetest.get_modpath("intllib")) then + dofile(minetest.get_modpath("intllib").."/intllib.lua") + S = intllib.Getter(minetest.get_current_modname()) +else + S = function ( s ) return s end +end + local version = "0.0.3" minetest.log("action","MOD: trap mod loading ...") minetest.register_craftitem("trap:undead", { - description = "Trap for undead mobs", + description = S("Trap for undead mobs"), image = minetest.inventorycube("trap_undead.png","trap_undead.png","trap_undead.png"), on_place = function(item, placer, pointed_thing) if pointed_thing.type == "node" then @@ -76,7 +85,7 @@ minetest.register_entity(":trap:undead_ent", minetest.register_node("trap:cought_vombie", { - description = "Trap containing vombie", + description = S("Trap containing vombie"), tile_images = {"trap_cought_vombie.png"}, drawtype = "normal", groups = { snappy=3 }, @@ -84,4 +93,4 @@ minetest.register_node("trap:cought_vombie", { light_source = 2, }) -minetest.log("action","MOD: trap mod version " .. version .. " loaded") \ No newline at end of file +minetest.log("action","MOD: trap mod version " .. version .. " loaded") diff --git a/trap/locale/de.txt b/trap/locale/de.txt new file mode 100644 index 0000000..ff0cd5f --- /dev/null +++ b/trap/locale/de.txt @@ -0,0 +1,4 @@ +# Translation by Xanthin + +Trap for undead mobs = Falle fuer untote Wesen +Trap containing vombie = Falle mit Vombie diff --git a/trap/locale/template.txt b/trap/locale/template.txt new file mode 100644 index 0000000..e845a24 --- /dev/null +++ b/trap/locale/template.txt @@ -0,0 +1,4 @@ +# Template + +Trap for undead mobs = +Trap containing vombie =