From 341a438267765ee69fc12c2b5ce855a4623f3eeb Mon Sep 17 00:00:00 2001 From: Louis Royer <55180044+louisroyer@users.noreply.github.com> Date: Wed, 15 Jul 2020 20:21:06 +0200 Subject: [PATCH] Search items by English and translated description (#156) This works only with Minetest version >= 5.3.0, nothing is changed for older versions. --- internal.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/internal.lua b/internal.lua index ee8b4a9..eeab695 100644 --- a/internal.lua +++ b/internal.lua @@ -290,10 +290,14 @@ function unified_inventory.apply_filter(player, filter, search_dir) return true end else + local lang = minetest.get_player_information(player_name).lang_code ffilter = function(name, def) local lname = string.lower(name) local ldesc = string.lower(def.description) + local llocaldesc = minetest.get_translated_string + and string.lower(minetest.get_translated_string(lang, def.description)) return string.find(lname, lfilter, 1, true) or string.find(ldesc, lfilter, 1, true) + or llocaldesc and string.find(llocaldesc, lfilter, 1, true) end end unified_inventory.filtered_items_list[player_name]={}