Make ItemWithLabel::label accept LocalisedString

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
Post Reply
PFQNiet
Filter Inserter
Filter Inserter
Posts: 289
Joined: Sat Sep 05, 2020 7:48 pm
Contact:

Make ItemWithLabel::label accept LocalisedString

Post by PFQNiet »

I have a tool that is used by holding it in the cursor. I'd like to use its label to provide feedback to the user, but it only supports strings, not LocalisedString. This would be fine for, say, numeric feedback, but I want it to say "no signal" under certain circumstances and I can't do that in a localised manner.

My current workaround is to just have it periodically pop up flying text over the player, which works but it could be much better.

User avatar
raiguard
Factorio Staff
Factorio Staff
Posts: 451
Joined: Wed Dec 13, 2017 8:29 pm
Contact:

Re: Make ItemWithLabel::label accept LocalisedString

Post by raiguard »

In the meantime, you could use localisation in item labels by using LuaPlayer::request_translation() and storing the translation in the player's global table.
Don't forget, you're here forever.

User avatar
raiguard
Factorio Staff
Factorio Staff
Posts: 451
Joined: Wed Dec 13, 2017 8:29 pm
Contact:

Re: Make ItemWithLabel::label accept LocalisedString

Post by raiguard »

I'm back to +1 this. I am messing with item labels myself now, and them not supporting localised strings is a huge bummer. I can use flib's translation module to get them, but that is a huge amount of added complexity for such a small thing. I hope for the best! :)
2020-11-25 12_01_25-Factorio 1.1.1.png
2020-11-25 12_01_25-Factorio 1.1.1.png (5.17 KiB) Viewed 655 times
Don't forget, you're here forever.

Post Reply

Return to “Modding interface requests”