From c7f80ce96017dfc99547984f5afc41bf21b6b080 Mon Sep 17 00:00:00 2001 From: codexp Date: Fri, 13 Jul 2018 14:03:30 +0200 Subject: [PATCH] Refactor Lua format in locales --- circular_saw.lua | 34 +++++++++++++++++++++++------ locale/de.po | 52 +++++++++++++++++---------------------------- locale/es.po | 15 ++++++------- locale/fr.po | 19 +++++++---------- locale/it.po | 9 ++++---- locale/template.pot | 15 ++++++------- ownership.lua | 2 +- 7 files changed, 71 insertions(+), 75 deletions(-) diff --git a/circular_saw.lua b/circular_saw.lua index 1dce479..3eb93e5 100644 --- a/circular_saw.lua +++ b/circular_saw.lua @@ -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: diff --git a/locale/de.po b/locale/de.po index 8ca674b..86c226c 100644 --- a/locale/de.po +++ b/locale/de.po @@ -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" diff --git a/locale/es.po b/locale/es.po index e5d1d53..0ac28c9 100644 --- a/locale/es.po +++ b/locale/es.po @@ -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 diff --git a/locale/fr.po b/locale/fr.po index cf42ebc..8b7aa82 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -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" diff --git a/locale/it.po b/locale/it.po index dd2f73b..d5aa412 100644 --- a/locale/it.po +++ b/locale/it.po @@ -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" diff --git a/locale/template.pot b/locale/template.pot index 250d02d..f6d221f 100644 --- a/locale/template.pot +++ b/locale/template.pot @@ -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 diff --git a/ownership.lua b/ownership.lua index 20f0fe1..8c8b4f1 100644 --- a/ownership.lua +++ b/ownership.lua @@ -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