Refactor Lua format in locales

This commit is contained in:
codexp 2018-07-13 14:03:30 +02:00 committed by Hugo Locurcio
parent 4605ed7848
commit c7f80ce960
No known key found for this signature in database
GPG Key ID: 39E8F8BE30B0A49C
7 changed files with 71 additions and 75 deletions

View File

@ -126,15 +126,22 @@ end
function circular_saw:reset(pos)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
local owned_by = meta:get_string("owner")
if owned_by and owned_by ~= "" then
owned_by = " " .. S("(owned by @1)", meta:get_string("owner"))
else
owned_by = ""
end
inv:set_list("input", {})
inv:set_list("micro", {})
inv:set_list("output", {})
meta:set_int("anz", 0)
meta:set_int("anz", 0)
meta:set_string("infotext",
S("Circular Saw is empty (owned by %s)")
:format(meta:get_string("owner") or ""))
S("Circular Saw is empty") .. owned_by
)
end
@ -167,6 +174,13 @@ function circular_saw:update_inventory(pos, amount)
local name_parts = circular_saw.known_nodes[node_name] or ""
local modname = name_parts[1] or ""
local material = name_parts[2] or ""
local owned_by = meta:get_string("owner")
if owned_by and owned_by ~= "" then
owned_by = " " .. S("(owned by @1)", meta:get_string("owner"))
else
owned_by = ""
end
inv:set_list("input", { -- Display as many full blocks as possible:
node_name.. " " .. math.floor(amount / 8)
@ -191,8 +205,8 @@ function circular_saw:update_inventory(pos, amount)
meta:set_int("anz", amount)
meta:set_string("infotext",
S("Circular Saw is working on %s (owned by %s)")
:format(material, meta:get_string("owner") or ""))
S("Circular Saw is working on @1") .. owned_by
)
end
@ -427,10 +441,16 @@ minetest.register_node("moreblocks:circular_saw", {
after_place_node = function(pos, placer)
local meta = minetest.get_meta(pos)
local owner = placer and placer:get_player_name() or ""
local owned_by = owner
if owner ~= "" then
owned_by = " " .. S("(owned by @1)", owner)
end
meta:set_string("owner", owner)
meta:set_string("infotext",
S("Circular Saw is empty (owned by %s)")
:format(owner))
S("Circular Saw is empty") . owned_by
)
end,
-- The amount of items offered per shape can be configured:

View File

@ -18,7 +18,7 @@ msgstr ""
#: circular_saw.lua
msgid "Circular Saw"
msgstr "Kreissaege"
msgstr "Kreissäge"
#: circular_saw.lua
msgid ""
@ -49,47 +49,40 @@ msgid "Set"
msgstr "Ok"
#: circular_saw.lua
#, fuzzy, lua-format
msgid "Circular Saw is empty (owned by %s)"
msgstr "Kreissaege ist leer (gehoert %s)"
msgid "(owned by @1)"
msgstr "(gehört @1)"
#: circular_saw.lua
#, fuzzy, lua-format
msgid "Circular Saw is working on %s (owned by %s)"
msgstr "Kreissaege, arbeitet mit %s (gehoert %s)"
msgid "Circular Saw is working on @1"
msgstr "Kreissäge arbeitet mit @1"
#: circular_saw.lua
#, fuzzy
msgid "Circular Saw is empty"
msgstr "Kreissaege, leer"
msgstr "Kreissäge ist leer"
#: init.lua
msgid "[moreblocks] loaded."
msgstr "[moreblocks] geladen."
#: nodes.lua
#, fuzzy
msgid "All-faces Acacia Tree"
msgstr "Baumscheibenstamm"
msgstr "Akazien Baumstamm (allseitig)"
#: nodes.lua
#, fuzzy
msgid "All-faces Aspen Tree"
msgstr "Baumscheibenstamm"
msgstr "Espen Baumstamm (allseitig)"
#: nodes.lua
#, fuzzy
msgid "All-faces Jungle Tree"
msgstr "Baumscheibenstamm"
msgstr "Tropenbaum Baumstamm (allseitig)"
#: nodes.lua
#, fuzzy
msgid "All-faces Pine Tree"
msgstr "Baumscheibenstamm"
msgstr "Kiefer Baumstamm (allseitig)"
#: nodes.lua
msgid "All-faces Tree"
msgstr "Baumscheibenstamm"
msgstr "Baumstamm (allseitig)"
#: nodes.lua
msgid "Cactus Brick"
@ -104,9 +97,8 @@ msgid "Centered Wooden Tile"
msgstr "Holzfliese mittig"
#: nodes.lua
#, fuzzy
msgid "Checker Stone Tile"
msgstr "Steinfliese"
msgstr "Schachsteinfliese"
#: nodes.lua
msgid "Circle Stone Bricks"
@ -145,9 +137,8 @@ msgid "Copper Patina Block"
msgstr ""
#: nodes.lua
#, fuzzy
msgid "Empty Shelf"
msgstr "Leeres Buecherregal"
msgstr "Leeres Regal"
#: nodes.lua
msgid "Full Wooden Tile"
@ -191,9 +182,8 @@ msgid "Split Stone Tile"
msgstr "Geteilte Steinfliese"
#: nodes.lua
#, fuzzy
msgid "Stone Bricks"
msgstr "Kohlesteinziegel"
msgstr "Steinziegel"
#: nodes.lua
msgid "Stone Tile"
@ -212,9 +202,8 @@ msgid "Tar"
msgstr ""
#: nodes.lua
#, fuzzy
msgid "Trap Desert Stone"
msgstr "Steinfalle"
msgstr "Wüstensteinfalle"
#: nodes.lua
msgid "Trap Glass"
@ -229,14 +218,12 @@ msgid "Trap Obsidian"
msgstr ""
#: nodes.lua
#, fuzzy
msgid "Trap Obsidian Glass"
msgstr "Glasfalle"
msgstr "Obsidianglasfalle"
#: nodes.lua
#, fuzzy
msgid "Trap Sandstone"
msgstr "Steinfalle"
msgstr "Sandsteinfalle"
#: nodes.lua
msgid "Trap Stone"
@ -271,9 +258,8 @@ msgid "Leftwards Wooden Tile (Deprecated)"
msgstr "Holzfliese links"
#: ownership.lua
#, lua-format
msgid "Sorry, %s owns that spot."
msgstr "Tut mir leid, %s gehoert diese Stelle."
msgid "Sorry, @1 owns that spot."
msgstr "Tut mir leid, dieser Bereich gehört @1."
#: ownership.lua
msgid "someone"

View File

@ -45,19 +45,17 @@ msgid "Set"
msgstr ""
#: circular_saw.lua
#, lua-format
msgid "Circular Saw is empty (owned by %s)"
msgstr ""
#: circular_saw.lua
#, lua-format
msgid "Circular Saw is working on %s (owned by %s)"
msgid "(owned by @1)"
msgstr ""
#: circular_saw.lua
msgid "Circular Saw is empty"
msgstr ""
#: circular_saw.lua
msgid "Circular Saw is working on @1"
msgstr ""
#: init.lua
msgid "[moreblocks] loaded."
msgstr "[moreblocks] cargado."
@ -270,8 +268,7 @@ msgid "Leftwards Wooden Tile (Deprecated)"
msgstr "Parquet Izquierdo"
#: ownership.lua
#, lua-format
msgid "Sorry, %s owns that spot."
msgid "Sorry, @1 owns that spot."
msgstr ""
#: ownership.lua

View File

@ -50,19 +50,17 @@ msgid "Set"
msgstr "Définir"
#: circular_saw.lua
#, lua-format
msgid "Circular Saw is empty (owned by %s)"
msgstr "Scie circulaire vide (propriété de %s)"
#: circular_saw.lua
#, lua-format
msgid "Circular Saw is working on %s (owned by %s)"
msgstr "Scie circulaire, manipule %s (propriété de %s)"
msgid "(owned by @1)"
msgstr "(propriété de @1)"
#: circular_saw.lua
msgid "Circular Saw is empty"
msgstr "Scie circulaire vide"
#: circular_saw.lua
msgid "Circular Saw is working on @1"
msgstr "Scie circulaire manipulant @1"
#: init.lua
msgid "[moreblocks] loaded."
msgstr "[moreblocks] a été chargé."
@ -256,9 +254,8 @@ msgid "Leftwards Wooden Tile (Deprecated)"
msgstr "Dalle en bois vers la gauche (déprécié)"
#: ownership.lua
#, lua-format
msgid "Sorry, %s owns that spot."
msgstr "Désolé, %s possède cet endroit."
msgid "Sorry, @1 owns that spot."
msgstr "Désolé, @1 possède cet endroit."
#: ownership.lua
msgid "someone"

View File

@ -50,12 +50,12 @@ msgstr "Imp."
#: circular_saw.lua
#, fuzzy, lua-format
msgid "Circular Saw is empty (owned by %s)"
msgid "Circular Saw is empty"
msgstr "La sega circolare è vuota (di proprietà di %s)"
#: circular_saw.lua
#, fuzzy, lua-format
msgid "Circular Saw is working on %s (owned by %s)"
msgid "Circular Saw is working on %s"
msgstr "Sega circolare, in funzione su %s (di proprietà di %s)"
#: circular_saw.lua
@ -271,9 +271,8 @@ msgid "Leftwards Wooden Tile (Deprecated)"
msgstr "Mattonella in legno verso sinistra"
#: ownership.lua
#, lua-format
msgid "Sorry, %s owns that spot."
msgstr "Spiacente, quel punto è di proprietà di %s"
msgid "Sorry, @1 owns that spot."
msgstr "Spiacente, quel punto è di proprietà di @1"
#: ownership.lua
msgid "someone"

View File

@ -44,19 +44,17 @@ msgid "Set"
msgstr ""
#: circular_saw.lua
#, lua-format
msgid "Circular Saw is empty (owned by %s)"
msgstr ""
#: circular_saw.lua
#, lua-format
msgid "Circular Saw is working on %s (owned by %s)"
msgid "(owned by @1)"
msgstr ""
#: circular_saw.lua
msgid "Circular Saw is empty"
msgstr ""
#: circular_saw.lua
msgid "Circular Saw is working on @1"
msgstr ""
#: init.lua
msgid "[moreblocks] loaded."
msgstr ""
@ -250,8 +248,7 @@ msgid "Leftwards Wooden Tile (Deprecated)"
msgstr ""
#: ownership.lua
#, lua-format
msgid "Sorry, %s owns that spot."
msgid "Sorry, @1 owns that spot."
msgstr ""
#: ownership.lua

View File

@ -33,7 +33,7 @@ function moreblocks.node_is_owned(pos, placer)
end
if ownername ~= false then
minetest.chat_send_player( placer:get_player_name(), S("Sorry, %s owns that spot."):format(ownername) )
minetest.chat_send_player( placer:get_player_name(), S("Sorry, @1 owns that spot.", ownername) )
return true
else
return false