[0.18.22] rendering.draw_text cannot access Scenario's locale when savefile loaded

This subforum contains all the issues which we already resolved.
Post Reply
Burner Inserter
Burner Inserter
Posts: 13
Joined: Sun Jun 24, 2018 7:06 pm

[0.18.22] rendering.draw_text cannot access Scenario's locale when savefile loaded

Post by Hanakocz »


I wanted to include localized rendered text in my scenario. This looks like very easy thing to do and it was, as rendering.draw_text supports localized strings. So I included my own locale file into the scenario and added the localized message.

This works fine when spawning the renders, but when you save the game and load it again, all scenario-localized rendering texts change to Unknown key error messages. Localized texts using vanilla locales load fine. Creating new renderings with same locale keys also work fine, until one saves the game and loads it again. Localization is loading properly for chat messages and gui and everything.

I created absolutely tiny scenario to demonstrate this (attachments). Steps to reproduce are then :
1) start a scenario that uses own locale files
2) use draw_text that use localized string from the scenario's locale
3) save the game, exit, and load the game again. Scenario's locales will be broken.

When game opened first time and scenario creates cars with added render texts bound to them, the top left one has

Code: Select all

text = {"entity-name.car"}
while the other has

Code: Select all

text = {"my_locale.car"}
which takes the entry from scenario added locale:
locale1.png (1.15 MiB) Viewed 229 times
When I save the game, exit and load again, this same stuff turns into this:
locale2.png (1.16 MiB) Viewed 229 times
Is there a way to fix this behaviour? I am not really a fan of tracking all rendertexts into global table and re-drawing them whenever player joins (as rendering class is unaccessible from on_load() event). Static texts also aren't really viable as some people just don't understand all the languages.
(1.49 KiB) Downloaded 9 times

Factorio Staff
Factorio Staff
Posts: 4665
Joined: Thu Jun 11, 2015 1:35 pm

Re: [0.18.22] rendering.draw_text cannot access Scenario's locale when savefile loaded

Post by posila »

Thanks for the report.
Fixed for 0.18.41

Post Reply

Return to “Resolved Problems and Bugs”

Who is online

Users browsing this forum: No registered users