From 35bb569ee131700435628ff6e8d776040d906c31 Mon Sep 17 00:00:00 2001 From: Araca Date: Tue, 31 Oct 2023 10:00:58 +0000 Subject: [PATCH] make craft guide search use local language (#3984) Fix #3909 It is now possible to search in the crafting guide using both item id ("name", usually related to the English name) and translated item description (containing the displayed in-game name). Co-authored-by: Araca <> Reviewed-on: https://git.minetest.land/MineClone2/MineClone2/pulls/3984 Reviewed-by: the-real-herowl Co-authored-by: Araca Co-committed-by: Araca --- mods/HELP/mcl_craftguide/init.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mods/HELP/mcl_craftguide/init.lua b/mods/HELP/mcl_craftguide/init.lua index 5e3686047..80df19b90 100644 --- a/mods/HELP/mcl_craftguide/init.lua +++ b/mods/HELP/mcl_craftguide/init.lua @@ -774,7 +774,7 @@ local function search(data) for i = 1, #data.items_raw do local item = data.items_raw[i] local def = reg_items[item] - local desc = lower(def.description) + local desc = string.lower(M.get_translated_string(data.lang_code, def.description)) local search_in = item .. desc local to_add @@ -838,6 +838,7 @@ local function init_data(name) iX = sfinv_only and 8 or DEFAULT_SIZE, items = init_items, items_raw = init_items, + lang_code = M.get_player_information(name).lang_code or 'en', } end