diff --git a/locale/es.txt b/locale/es.txt index 96a1e3f4..49ec8aef 100644 --- a/locale/es.txt +++ b/locale/es.txt @@ -176,3 +176,5 @@ Small CRT Television = Pequeña Televisión CRT E: character map file not found = E: archivo de mapa de caracteres no encontrado ## 1: Full String, 2: pos in string, 3: current char at pos W: unknown symbol in '%s' at %d (probably %s) = A: símbolo desconocido en '%s' posición %d (probablemente %s) +%s wrote "%s" to sign at %s = %s ha escrito "%s" en el letrero en %s +signs loaded = letreros cargados diff --git a/locale/fr.txt b/locale/fr.txt index fed1410b..2a17a282 100644 --- a/locale/fr.txt +++ b/locale/fr.txt @@ -176,3 +176,5 @@ Small CRT Television = Petite télévision à tube cathodique E: character map file not found = E: fichier de table de caractère non trouvé ## 1: Full String, 2: pos in string, 3: current char at pos W: unknown symbol in '%s' at %d (probably %s) = A: symbole inconnu dans '%s' dans %d (probablement %s) +%s wrote "%s" to sign at %s = +signs loaded = diff --git a/locale/template.txt b/locale/template.txt index 864e2858..7a82f3a3 100644 --- a/locale/template.txt +++ b/locale/template.txt @@ -180,3 +180,5 @@ Small CRT Television = E: character map file not found = ## 1: Full String, 2: pos in string, 3: current char at pos W: unknown symbol in '%s' at %d (probably %s) = +%s wrote "%s" to sign at %s = +signs loaded = diff --git a/signs_lib.lua b/signs_lib.lua index 2a672b6f..7f98475b 100644 --- a/signs_lib.lua +++ b/signs_lib.lua @@ -1,11 +1,20 @@ -- Font: 04.jp.org +-- 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 + -- load characters map local chars_file = io.open(minetest.get_modpath("homedecor").."/characters", "r") local charmap = {} local max_chars = 16 if not chars_file then - print("[signs] E: character map file not found") + print("[signs] "..S("E: character map file not found")) else while true do local char = chars_file:read("*l") @@ -144,11 +153,6 @@ minetest.register_node(":default:sign_wall", { itemstack:take_item() return itemstack elseif wdir == 1 then - local def = minetest.registered_nodes[minetest.env:get_node(pointed_thing.above).name] - if homedecor_node_is_owned(pointed_thing.above, placer) - or (not def.buildable_to) then - return - end minetest.env:add_node(above, {name = "signs:sign_yard", param2 = fdir}) sign_info = signs_yard[fdir + 1] else @@ -156,6 +160,12 @@ minetest.register_node(":default:sign_wall", { sign_info = signs[fdir + 1] end + local def = minetest.registered_nodes[minetest.env:get_node(pointed_thing.above).name] + if homedecor_node_is_owned(pointed_thing.above, placer) + or (not def.buildable_to) then + return + end + local text = minetest.env:add_entity({x = above.x + sign_info.delta.x, y = above.y + sign_info.delta.y, z = above.z + sign_info.delta.z}, "signs:text") @@ -172,6 +182,13 @@ minetest.register_node(":default:sign_wall", { homedecor_destruct_sign(pos) end, on_receive_fields = function(pos, formname, fields, sender) + if fields then + print(S("%s wrote \"%s\" to sign at %s"):format( + (sender:get_player_name() or ""), + fields.text, + minetest.pos_to_string(pos) + )) + end homedecor_update_sign(pos, fields) end, on_punch = function(pos, node, puncher) @@ -200,6 +217,13 @@ minetest.register_node(":signs:sign_yard", { homedecor_destruct_sign(pos) end, on_receive_fields = function(pos, formname, fields, sender) + if fields then + print(S("%s wrote \"%s\" to sign at %s"):format( + (sender:get_player_name() or ""), + fields.text, + minetest.pos_to_string(pos) + )) + end homedecor_update_sign(pos, fields) end, on_punch = function(pos, node, puncher) @@ -401,6 +425,13 @@ function homedecor_register_fence_with_sign(fencename, fencewithsignname) homedecor_destruct_sign(pos) end def_sign.on_receive_fields = function(pos, formname, fields, sender, ...) + if fields then + print(S("%s wrote \"%s\" to sign at %s"):format( + (sender:get_player_name() or ""), + fields.text, + minetest.pos_to_string(pos) + )) + end homedecor_update_sign(pos, fields) end def_sign.on_punch = function(pos, node, puncher, ...) @@ -418,5 +449,5 @@ function homedecor_register_fence_with_sign(fencename, fencewithsignname) end if minetest.setting_get("log_mods") then - minetest.log("action", "signs loaded") + minetest.log("action", S("signs loaded")) end