From 5710667766b2ef3abcb95a7c88963c8f0c9ef865 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Wed, 20 Mar 2019 13:38:31 +0100 Subject: [PATCH] Fix translation of format string --- init.lua | 11 ++++++----- locale/hudbars.de.tr | 2 +- locale/hudbars.it.tr | 2 +- locale/hudbars.ms.tr | 2 +- locale/hudbars.nl.tr | 2 +- locale/hudbars.pt.tr | 2 +- locale/hudbars.tr.tr | 2 +- locale/template.txt | 2 +- 8 files changed, 13 insertions(+), 12 deletions(-) diff --git a/init.lua b/init.lua index f521eec..eba3747 100644 --- a/init.lua +++ b/init.lua @@ -1,4 +1,5 @@ local S = minetest.get_translator("hudbars") +local N = function(s) return s end hb = {} @@ -123,7 +124,7 @@ function hb.register_hudbar(identifier, text_color, label, textures, default_sta end end if format_string == nil then - format_string = S("%s: %d/%d") + format_string = N("@1: @2/@3") end hudtable.add_all = function(player, hudtable, start_value, start_max, start_hidden) @@ -148,7 +149,7 @@ function hb.register_hudbar(identifier, text_color, label, textures, default_sta iconscale = { x=1, y=1 } barnumber = hb.value_to_barlength(start_value, start_max) bgiconnumber = hb.settings.statbar_length - text = string.format(format_string, label, start_value, start_max) + text = S(format_string, label, start_value, start_max) end if hb.settings.bar_type == "progress_bar" then ids.bg = player:hud_add({ @@ -298,7 +299,7 @@ function hb.change_hudbar(player, identifier, new_value, new_max_value, new_icon end if new_label ~= nil then hudtable.label = new_label - local new_text = string.format(hudtable.format_string, new_label, hudtable.hudstate[name].value, hudtable.hudstate[name].max) + local new_text = S(hudtable.format_string, new_label, hudtable.hudstate[name].value, hudtable.hudstate[name].max) player:hud_change(hudtable.hudids[name].text, "text", new_text) end if new_text_color ~= nil then @@ -342,7 +343,7 @@ function hb.change_hudbar(player, identifier, new_value, new_max_value, new_icon end if hb.settings.bar_type == "progress_bar" then - local new_text = string.format(hudtable.format_string, hudtable.label, new_value, new_max_value) + local new_text = S(hudtable.format_string, hudtable.label, new_value, new_max_value) if new_text ~= hudtable.hudstate[name].text then player:hud_change(hudtable.hudids[name].text, "text", new_text) hudtable.hudstate[name].text = new_text @@ -389,7 +390,7 @@ function hb.unhide_hudbar(player, identifier) if hudtable.hudstate[name].max ~= 0 then player:hud_change(hudtable.hudids[name].bg, "scale", {x=1,y=1}) end - player:hud_change(hudtable.hudids[name].text, "text", tostring(string.format(hudtable.format_string, hudtable.label, value, max))) + player:hud_change(hudtable.hudids[name].text, "text", tostring(S(hudtable.format_string, hudtable.label, value, max))) elseif hb.settings.bar_type == "statbar_modern" then player:hud_change(hudtable.hudids[name].bg, "number", hb.settings.statbar_length) end diff --git a/locale/hudbars.de.tr b/locale/hudbars.de.tr index 5188992..3d1e697 100644 --- a/locale/hudbars.de.tr +++ b/locale/hudbars.de.tr @@ -1,4 +1,4 @@ # textdomain: hudbars Health=Leben Breath=Atem -%s: %d/%d=%s: %d/%d +@1: @2/@3=@1: @2/@3 diff --git a/locale/hudbars.it.tr b/locale/hudbars.it.tr index 01b1c48..3ada5b6 100644 --- a/locale/hudbars.it.tr +++ b/locale/hudbars.it.tr @@ -3,4 +3,4 @@ Health=Salute Breath=Ossigeno # Default format string for progress bar-style HUD bars, e.g. “Health 5/20” -%s: %d/%d +@1: @2/@3=@1: @2/@3 diff --git a/locale/hudbars.ms.tr b/locale/hudbars.ms.tr index 0ab24fb..eb811ab 100644 --- a/locale/hudbars.ms.tr +++ b/locale/hudbars.ms.tr @@ -1,4 +1,4 @@ # textdomain: hudbars Health=Kesihatan Breath=Nafas -%s: %d/%d=%s: %d/%d +@1: @2/@3=@1: @2/@3 diff --git a/locale/hudbars.nl.tr b/locale/hudbars.nl.tr index e795d67..b9c4a41 100644 --- a/locale/hudbars.nl.tr +++ b/locale/hudbars.nl.tr @@ -3,4 +3,4 @@ Health=Gezondheid Breath=Adem # Default format string for progress bar-style HUD bars, e.g. “Health 5/20” -%s: %d/%d +@1: @2/@3=@1: @2/@3 diff --git a/locale/hudbars.pt.tr b/locale/hudbars.pt.tr index 8d3fbee..a818f09 100644 --- a/locale/hudbars.pt.tr +++ b/locale/hudbars.pt.tr @@ -3,4 +3,4 @@ Health=Saude Breath=Folego # Formato de string padrão para progresso bar-style de barras do HUD, por exemplo “Saude 5/20” -%s: %d/%d +@1: @2/@3=@1: @2/@3 diff --git a/locale/hudbars.tr.tr b/locale/hudbars.tr.tr index 233f1be..6a2ce0b 100644 --- a/locale/hudbars.tr.tr +++ b/locale/hudbars.tr.tr @@ -1,4 +1,4 @@ # textdomain: hudbars Health=Can Breath=Nefes -%s: %d/%d=%s: %d/%d +@1: @2/@3=@1: @2/@3 diff --git a/locale/template.txt b/locale/template.txt index 67398f0..37b0559 100644 --- a/locale/template.txt +++ b/locale/template.txt @@ -3,4 +3,4 @@ Health= Breath= # Default format string for progress bar-style HUD bars, e.g. “Health 5/20” -%s: %d/%d= +@1: @2/@3=