[Genhis] [1.1.73] LuaPlayer::request_translation does not work with fallback groups

This subforum contains all the issues which we already resolved.
User avatar
raiguard
Factorio Staff
Factorio Staff
Posts: 577
Joined: Wed Dec 13, 2017 8:29 pm
Contact:

[Genhis] [1.1.73] LuaPlayer::request_translation does not work with fallback groups

Post by raiguard »

LuaPlayer::request_translation does not handle the new fallback groups format, and fails the translation if you attempt to use it.

To reproduce:
1. Copy the below code into a mod control.lua
2. Start a new game
3. Observe that the frame in the top-left correctly shows ice-cream
4. Observe the chat message notifying that the translation request failed

Code: Select all

local string = { "?", { "item-name.ice-cream" }, "ice-cream" }

script.on_event(defines.events.on_player_created, function(e)
  local player = game.get_player(e.player_index) --[[@as LuaPlayer]]
  player.gui.top.add({ type = "frame", caption = string })
  player.request_translation(string)
end)

script.on_event(defines.events.on_string_translated, function(e)
  if not e.translated then
    game.print("Translation failed: " .. serpent.line(e.localised_string))
  end
end)
Also, with this update, the behavior of this function changed to fail a translation if any substring is invalid - before, it would only fail if the top-level string was invalid. However, this new behavior feels like the correct behavior, and I can work around it using fallbacks once those are fixed.
Don't forget, you're here forever.

irwinclockmeyer
Burner Inserter
Burner Inserter
Posts: 5
Joined: Sun Jan 07, 2018 3:14 pm
Contact:

Re: [Genhis] [1.1.73] LuaPlayer::request_translation does not work with fallback groups

Post by irwinclockmeyer »

Is there a way to turn off the "Translating dictionaries" dialog until this bug is fixed?

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

Re: [Genhis] [1.1.73] LuaPlayer::request_translation does not work with fallback groups

Post by raiguard »

The dialog is unable to be turned off by design. If it was disable-able then most players would turn it off and if something broke (like it did here), they would not have all of the information to file a proper bug report.

You can destroy the GUI window using a console command, but I can't guarantee that that will work consistently.
Don't forget, you're here forever.

Post Reply

Return to “Resolved Problems and Bugs”