Localization not found

Place to get help with not working mods / modding interface.
Post Reply
hlship
Burner Inserter
Burner Inserter
Posts: 5
Joined: Mon Nov 27, 2023 1:00 am
Contact:

Localization not found

Post 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?

Pi-C
Smart Inserter
Smart Inserter
Posts: 1659
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: Localization not found

Post 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.
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!

hlship
Burner Inserter
Burner Inserter
Posts: 5
Joined: Mon Nov 27, 2023 1:00 am
Contact:

Re: Localization not found

Post by hlship »

... and that worked! Thought I had already tried it, but I guess not. Thanks for the little push.

Pi-C
Smart Inserter
Smart Inserter
Posts: 1659
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: Localization not found

Post by Pi-C »

You're welcome! :-)
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!

Post Reply

Return to “Modding help”