when i enter something like
data.localised_name = { "__1__ ["..data.name.."]", {'item-name.' .. data.name}}
it results in Unknown key: "Copper plate [copper-plate]"
how do i get rid of this unknown key thing?
i wanted to make a mod where modders can see the internal names of everything
dynamic localized names
dynamic localized names
mods.factorio.com/user/ownlyme
My requests: uiAbove||Grenade arc||Blueprint allies||Creeps forget command/ don't get removed||Player Modifiers||textbox::selection||Better Heat IF||Singleplayer RCON||tank bug w/ min_range >= projectile_creation_distance
My requests: uiAbove||Grenade arc||Blueprint allies||Creeps forget command/ don't get removed||Player Modifiers||textbox::selection||Better Heat IF||Singleplayer RCON||tank bug w/ min_range >= projectile_creation_distance
Re: dynamic localized names
I was searching for info on manipulating other mods locale strings myself, and came across this gem of a thread. Apparently, there are many places the game can get the localised name of an item, and item-name.blah is not guaranteed to exist.
viewtopic.php?f=28&t=62107
In my case, I get what I need by reading the localised_string property of the source object prototype in data.raw, and using that as a variable in my own locale strings. I just remembered that this actually doesn't work. You can assign entity.localised_string, but it always reads as empty even if the mod you are referencing was loaded before. At this point I'm falling back on hard-coding whether to expect the mod's entity-description to be set or not.
viewtopic.php?f=28&t=62107
My mods: Multiple Unit Train Control, Smart Artillery Wagons
Maintainer of Vehicle Wagon 2, Cargo Ships, Honk
Maintainer of Vehicle Wagon 2, Cargo Ships, Honk
Re: dynamic localized names
As I understand it, temporarily move the locale folder outside the mod and restart the game. At that point all in lieu of readable item name and description, the internal name will be displayed.
Hiladdar
Hiladdar
- BlueTemplar
- Smart Inserter
- Posts: 2805
- Joined: Fri Jun 08, 2018 2:16 pm
- Contact:
Re: dynamic localized names
What do you mean by "see" ?
Maybe, I'm misunderstanding, but :
For 0.16 we have Mod Developer Tools :
https://mods.factorio.com/mod/ModDeveloperTools
And in 0.17 there's the show-debug-info-in-tooltips debug option, that looks to be largely inspired by this mod...
BobDiggity (mod-scenario-pack)
Re: dynamic localized names
Placeholders like __1__ go into string templates, which are in locale files e.g. locale/en/mod-name.cfg.ownlyme wrote: ↑Fri Mar 29, 2019 8:47 pmwhen i enter something like
data.localised_name = { "__1__ ["..data.name.."]", {'item-name.' .. data.name}}
it results in Unknown key: "Copper plate [copper-plate]"
how do i get rid of this unknown key thing?
i wanted to make a mod where modders can see the internal names of everything
The first entry in the table of a LocalisedString is the key for the template in the locale file.
So you need something like this in a .cfg file in locale/en/:
Code: Select all
[my-mod]
name-with-internal-name=__1__ [__2__]
Code: Select all
data.localised_name = { "my-mod.name-with-internal-name", {"item-name." .. data.name}, data.name }
Miniloader — UPS-friendly 1x1 loaders
Bulk Rail Loaders — Rapid train loading and unloading
Beltlayer & Pipelayer — Route items and fluids freely underground
Bulk Rail Loaders — Rapid train loading and unloading
Beltlayer & Pipelayer — Route items and fluids freely underground