graftorio-ng


visualize metrics from your factorio game in grafana

Utilities
1 year, 3 months ago
1.1
90
Transportation Logistics Trains Combat Enemies Environment Mining Fluids Logistic network Circuit network Manufacturing Power Storage

b Error on_string_translated

1 year, 3 months ago

Мод graftorio-ng (0.0.2) вызвал неустранимую ошибку.
Пожалуйста, сообщите об этой ошибке автору мода.

Error while running event graftorio-ng::on_string_translated (ID 153)
Cannot encode an empty string.
stack traceback:
[C]: in function 'encode_string'
graftorio-ng/scripts/translation.lua:124: in function 'handler'
core/lualib/event_handler.lua:47: in function <core/lualib/event_handler.lua:45>

1 year, 3 months ago
(updated 1 year, 3 months ago)

thanks for this information.

i dont know what caused this error.
will see if this is related to your language and incomplete game translation - which i dont believe.

can you reproduce it?
do you have other mods that may add other items / resources and stuff like that?
i currently haven't tested this mod with overhaul mods like Space Exploration or Krastorio 2.

1 year, 3 months ago

sadly im unable to replicate your issue.
would you mind opening a issue over at github and attach your save file?
or make it accessible here?

1 year, 3 months ago

Thanks for your reply.
To check, I tried to switch the interface language to English. It did not help.
I have a lot of mods installed (about 200). Including Space Exploration and Krastorio 2.
Here is the save file http://file.sampo.ru/dqsfv7/

1 year, 3 months ago

thank you for your savegame.
will try it.

but i think i may have discovered the issue already.
not all translation tasks are bound to an "translation exists" check and this could cause a 'Cannot encode an empty string.' exception.

i will look for a way to handle that.
hopefully this is exactly your problem.

1 year, 3 months ago

sadly this issue is beyond my skills.
i will eventually figure out how i can fix this or how to offload translation to the common flib.

but for now i will add a setting to disable translation at all.
may release the update tomorrow.

sorry.

1 year, 3 months ago

Can you please try to disable RecipeBook?

This prevented the crash on my side.
Are you also able to reproduce this?

1 year, 3 months ago
(updated 1 year, 3 months ago)

i ask on the Factorio discord for some help got some nice feedback and imported information:

Bilka :

Thank you for this. This looks like a bug in the base game to me and I reported it internally, the event.localised_string should not be empty.

However, the others are right and the mod should not need to use the translate functions in the first place

They told me about this from the Factorio changelog:
https://test.forums.factorio.com/viewtopic.php?t=60548

Version: 0.16.44
    - Added support for localised strings in LuaGameScript::write_file.

well... its an old code base that i use here.
i will try to figure out how I can drop the entire translation in the first place and make use of said feature from version 0.16.44.

1 year, 3 months ago

further information:

the log from the event that triggers the crash:

 139.262 Script @__graftorio-ng__/scripts/translation.lua:119: on_string_translated event:{
  id = 15158,
  localised_string = "",
  name = 153,
  player_index = 1,
  result = "Basic beacon",
  tick = 451,
  translated = true
}

the code snippet where it occurs translation.lua (added log() for debugging):

  [defines.events.on_string_translated] = function(event)
    log("on_string_translated event:"..serpent.block(event) )
    local result = event.result
    local str = event.localised_string
    str = game.encode_string(str)
1 year, 3 months ago

New version with workaround is online:

Version: 0.0.6
  - Add startup option to disable translation.

New response