Allow one localisation string to refer to another directly.

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
Post Reply
alercah
Fast Inserter
Fast Inserter
Posts: 151
Joined: Sun Apr 07, 2019 5:19 am
Contact:

Allow one localisation string to refer to another directly.

Post by alercah »

Background
This is similar to viewtopic.php?p=455859#p455859, but I think this is a bit of a different take on the request and that thread is quite old so I'm making a new one.

I'm currently working on adding descriptions to various things in Angel's mods. One thing that's vexing me is that, often, something in one mod has added uses in later mods. For instance, thermal water is added in Angel's Refining, but is also used in Angel's Bioprocessing as the food for red algae. I would like to be able to reference red algae in the localisation when red algae is enabled.
Request
Similar to the existing built-in parameters like __ITEM__item-name__, I would like there to be a parameter __LOCALE__category.locale-key__ which can be used to invoke another locale key directly. Ideally, it would also support a way to specify parameters to that locale-key (with {} like plurals?) but that is far less important.

This is not fundamentally different from the idea of the current __ITEM__, __ENTITY__, etc. parameters, except for one key difference: it looks up locale keys directly rather than checking the prototype for a localised_name. If I created enough fake entities to store local keys in the names of, I could do this with __ENTITY__, at least the parameterless version.
FAQ
  • Why can't you just copy-paste like people normally do when they want two locale strings?

    Because I am trying to write patches for a modpack maintained by other people, and if I put two similar strings in different places in different files that will need to be updated in sync, they will not be. They will become disconnected. Maybe not right away, but it's a near-guarantee that it will happen eventually. And it will mean that everyone working on locales will have to be very careful to search every other mod in case it happens to have a copy-paste of the same information.
  • How does this actually help you?

    Because I can make only certain parts of the locale strings overridable by later mods, ensuring that there is no copy-paste required, and also giving a clear signal for when a locale key is going to be changed and you need to look at other mods for it.
  • Why can't you do what Klonan suggested in this other thread you chose to ignore and put the parameters into the localised_description/localised_name?

    Because fundamentally this isn't the concern of the game script, it's a concern of the localisation. What makes sense to parameterize and factor out in English doesn't necessarily make sense in another language. Maybe it's because the entire sentence changes depending on what gender of word you put in. Or maybe in English, the bit that you're parameterizing is always in one piece, but in other languages it isn't---maybe you can't parameterise it at all, or maybe you need two or more pieces.

    For example, if you were to make a separate parameter for cardinal number words, like say {"number-word", 11} turns into "eleven", that's great in English. You can write "__1__ __plural_yadda_yadda_1{...}__". In a language where the number comes after the noun, you can do it the other way round: "__plural_yadda_yadda_1{...}___ __1__". And then you try to translate it to Irish, where the number eleven actually has the noun in the middle, and you can't do it. You can put it before, or after, but not both. Then you try to translate it to Japanese where you can't parameterise it at all because the number words are different for different kinds of objects.

    Putting the parameterisation into the Lua script forces all languages to use the exact same kind of parameterisation, and languages . It is not an adequate solution.
  • Ok, just do the fake entity thing.

    Great idea, except that it still doesn't work when a language needs more parameters than you made fake entities for, like the Irish example above.

Post Reply

Return to “Modding interface requests”