Page 1 of 1

Localization not found

Posted: Thu Nov 30, 2023 2:47 am
by hlship
I'm trying to localize my little mod.

Mod structure:

Code: Select all

├── control.lua
├── info.json
└── locale
    └── en
        └── en.cfg
 
This is in my en.cfg:

Code: Select all

[hls-qol]
filter-added=Filter: __1__
limit-set=__1__ < __2__
But my code, which accesses this as:

Code: Select all

player.create_local_flying_text({text = {"hls-qol.limit-set", recipe.localised_name, new_target}, position = inserter.position})
I see in my game "Unknown key: hls-qol.limit-set".

So, can you not use custom category names (naming it after my mod seemed to make sense) or is there something else I'm missing in terms of setup?

Re: Localization not found

Posted: Thu Nov 30, 2023 5:28 am
by Pi-C
hlship wrote: Thu Nov 30, 2023 2:47 am I see in my game "Unknown key: hls-qol.limit-set".

So, can you not use custom category names (naming it after my mod seemed to make sense) or is there something else I'm missing in terms of setup?
Your code seems to be alright. It is perfectly OK to use custom category names.

I suppose you started Factorio, then added the localization file OR edited categories/strings in an existing localization file, then loaded the game. This procedure is common when making changes to a control script. However, it doesn't work for localization, settings, or data stage changes. The localization files are read once when Factorio is loading. If you make any changes to it, you must restart Factorio for the changes to take effect.

Re: Localization not found

Posted: Thu Nov 30, 2023 5:34 am
by hlship
... and that worked! Thought I had already tried it, but I guess not. Thanks for the little push.

Re: Localization not found

Posted: Thu Nov 30, 2023 5:43 am
by Pi-C
You're welcome! :-)