From 8e74a80e91803062ab9ee6915918488521c64e88 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Thu, 19 Sep 2019 14:15:10 +0200 Subject: [PATCH] Translation: Fix parameter symbols --- internal.lua | 2 +- register.lua | 15 ++++++++------- waypoints.lua | 4 ++-- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/internal.lua b/internal.lua index 07ac530..05dc5f5 100644 --- a/internal.lua +++ b/internal.lua @@ -254,7 +254,7 @@ function unified_inventory.get_formspec(player, page) end end formspec[n] = "label[8.2,"..ui_peruser.form_header_y..";"..F(S("Page")) .. ": " - .. S("%s of %s"):format(page,pagemax).."]" + .. S("@1 of @2",page,pagemax).."]" end n= n+1 diff --git a/register.lua b/register.lua index b197ded..fe23ed2 100644 --- a/register.lua +++ b/register.lua @@ -1,4 +1,5 @@ local S = minetest.get_translator("unified_inventory") +local NS = function(s) return s end local F = minetest.formspec_escape minetest.register_privilege("creative", { @@ -54,7 +55,7 @@ unified_inventory.register_button("home_gui_set", { minetest.sound_play("dingdong", {to_player=player_name, gain = 1.0}) minetest.chat_send_player(player_name, - S("Home position set to: %s"):format(minetest.pos_to_string(home))) + S("Home position set to: @1", minetest.pos_to_string(home))) end else minetest.chat_send_player(player_name, @@ -219,9 +220,9 @@ local function stack_image_button(x, y, w, h, buttonname_prefix, item) local groupstring, andcount = unified_inventory.extract_groupnames(name) local grouptip if andcount == 1 then - grouptip = string.format(S("Any item belonging to the %s group"), groupstring) + grouptip = S("Any item belonging to the @1 group", groupstring) elseif andcount > 1 then - grouptip = string.format(S("Any item belonging to the groups %s"), groupstring) + grouptip = S("Any item belonging to the groups @1", groupstring) end grouptip = F(grouptip) if andcount >= 1 then @@ -232,8 +233,8 @@ local function stack_image_button(x, y, w, h, buttonname_prefix, item) end local recipe_text = { - recipe = S("Recipe %d of %d"), - usage = S("Usage %d of %d"), + recipe = NS("Recipe @1 of @2"), + usage = NS("Usage @1 of @2"), } local no_recipe_text = { recipe = S("No recipes"), @@ -279,7 +280,7 @@ unified_inventory.register_page("craftguide", { local item_name_shown if minetest.registered_items[item_name] and minetest.registered_items[item_name].description then - item_name_shown = string.format(S("%s (%s)"), + item_name_shown = S("@1 (@2)", minetest.registered_items[item_name].description, item_name) else item_name_shown = item_name @@ -403,7 +404,7 @@ unified_inventory.register_page("craftguide", { if alternates and alternates > 1 then fs[#fs + 1] = "label[5.5," .. (formspecy + 1.6) .. ";" - .. string.format(F(recipe_text[dir]), alternate, alternates) .. "]" + .. F(S(recipe_text[dir], alternate, alternates)) .. "]" .. "image_button[5.5," .. (formspecy + 2) .. ";1,1;ui_left_icon.png;alternate_prev;]" .. "image_button[6.5," .. (formspecy + 2) .. ";1,1;ui_right_icon.png;alternate;]" .. "tooltip[alternate_prev;" .. F(prev_alt_text[dir]) .. "]" diff --git a/waypoints.lua b/waypoints.lua index fb9746d..e23ef4b 100644 --- a/waypoints.lua +++ b/waypoints.lua @@ -35,13 +35,13 @@ unified_inventory.register_page("waypoints", { "ui_" .. i .. "_icon.png;" .. "select_waypoint" .. i .. ";]" .. "tooltip[select_waypoint" .. i .. ";" - .. (S("Select Waypoint #%d"):format(i)).."]" + .. S("Select Waypoint #@1", i).."]" end local i = waypoints.selected or 1 local waypoint = waypoints[i] or {} local temp = waypoints_temp[player_name][i] or {} - local default_name = string.format(S("Waypoint %d"), i) + local default_name = S("Waypoint @1", i) -- Main buttons: formspec = formspec ..