Please if possible expose function for converting localized_name to plain string.
I found no way to do it. (I was looking at API - http://lua-api.factorio.com/latest/Conc ... isedString - there is no way to do it described stated there).
The problem obvously isn't limited to non-english users because even in english display name often differs from internal name.
Use case:
filtering technologies by it's displayed name.
for name, tech in pairs(player.force.technologies) do
...
if not matches(tech.research_unit_ingredients, "name", t) and
(
not global.text_filter
or global.text_filter == ""
or tech.name and string.find(string.lower(tech.name), string.lower(global.text_filter), 1, true)
or name and string.find(string.lower(name), string.lower(global.text_filter), 1, true)
-- or tech.localized_name and string.find(string.lower(tech.localized_name), string.lower(global.text_filter), 1, true)
)
Mods wishing to have this are:
- Auto research
- Reseach queue
localized_name -> plain string [seems very simple]
-
- Fast Inserter
- Posts: 153
- Joined: Fri Jan 06, 2017 1:54 am
- Contact:
Re: localized_name -> plain string [seems very simple]
This isn't possible because the translations aren't deterministic across platforms. One person can have "copper-ore" translate to "An ore that's made of copper" and another could have it translate to "Purple fish" and it would still be valid.
Additionally the translation depends on the players current locale which isn't part of the game state data and isn't known by anyone except the local player.
Additionally the translation depends on the players current locale which isn't part of the game state data and isn't known by anyone except the local player.
If you want to get ahold of me I'm almost always on Discord.
-
- Fast Inserter
- Posts: 153
- Joined: Fri Jan 06, 2017 1:54 am
- Contact:
Re: localized_name -> plain string [seems very simple]
Well, I just want to get that string which is displayed to user, that's it. I don't need all of them.
My use case is quick search field in research queue mod.
I just want to filter technologies by part of it's current localized name.
My use case is quick search field in research queue mod.
I just want to filter technologies by part of it's current localized name.
- eradicator
- Smart Inserter
- Posts: 5211
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: localized_name -> plain string [seems very simple]
The only way to currently achieve this is to include all localized strings in your mods lua state and have the player chose a search language within your mod. :/ (i.e. reimplement localization)
@Rseding: How feasible would it be to dump (to file) the localized string of a different locale than the current one? I.e. to get a list of strings for this purpose without restarting the game for every locale required.
@Rseding: How feasible would it be to dump (to file) the localized string of a different locale than the current one? I.e. to get a list of strings for this purpose without restarting the game for every locale required.
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.