Fix flib_locale.of using derived type for fallback string

Fixes #80
This commit is contained in:
Caleb Heuer
2025-06-06 00:29:35 +02:00
parent 046392cfa7
commit 6ae3ed1a84
2 changed files with 3 additions and 1 deletions

View File

@@ -5,6 +5,8 @@ Date: ????
- Added `flib_prototypes.get_base_type` method.
Changes:
- Improved error messaging of flib_prototypes functions.
Bugfixes:
- Fixed that `flib_locale.of` would give an incorrect result in some cases. (#80)
---------------------------------------------------------------------------------------------------
Version: 0.16.2
Date: 2025-01-24

View File

@@ -18,7 +18,7 @@ function flib_locale.of(prototype, name)
elseif defines.prototypes.item[prototype.type] then
return flib_locale.of_item(prototype --[[@as data.ItemPrototype]])
else
return prototype.localised_name or { prototype.type .. "-name." .. prototype.name }
return prototype.localised_name or { flib_prototypes.get_base_type(prototype.type) .. "-name." .. prototype.name }
end
end