mirror of
https://git.minetest.land/MineClone2/MineClone2.git
synced 2024-11-28 05:43:43 +01:00
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 <the-real-herowl@noreply.git.minetest.land> Co-authored-by: Araca <araca.prod@gmail.com> Co-committed-by: Araca <araca.prod@gmail.com>
This commit is contained in:
parent
4fcd1ae541
commit
35bb569ee1
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user