Page 1 of 1

Localizing allowed_values without duplicating entries in the *.cfg file

Posted: Sun Feb 28, 2021 3:09 am
by <NO_NAME>
There is a series of drop-down lists in my mod settings, each containing the same allowed_values.
I know I can do localize them like this:

Code: Select all

[string-mod-setting]
my-mod-setting1-value1=Locale 1
my-mod-setting1-value2=Locale 2
# more values... (imagine 4 more lines here)
my-mod-setting1-value7=Locale 7
my-mod-setting2-value1=Locale 1
my-mod-setting2-value2=Locale 2
# more values... (imagine 4 more lines here)
my-mod-setting2-value7=Locale 7
# more settings (imagine 21 more lines here)
my-mod-setting6-value1=Locale 1
my-mod-setting6-value2=Locale 2
# more values... (imagine 4 more lines here)
my-mod-setting6-value7=Locale 7
but this way the file is almost entirely duplicates.
In this example I have 42 lines in the *.cfg file but really there is only 7 unique strings.

How can I assign arbitrary localized strings to drop-down entries, in similar way to how I can do that for setting name using the localised_name?

Re: Localizing allowed_values without duplicating entries in the *.cfg file

Posted: Tue Mar 09, 2021 7:59 am
by <NO_NAME>
OK, a real example from my latest mod.
Rohlinheatagtmuf Hdhaotaotfnllsape'atnsasri.cfg
(30.42 KiB) Downloaded 89 times
There is 165 entries in this file but it could be only 53 (> 3x less!) if duplicates were removed.

I'm using a template of the locale file and then create duplicate files by a script but this is a problematic approach if someone decides to look into sources and they doesn't use Linux. Is there a way to do it natively in the game?

Re: Localizing allowed_values without duplicating entries in the *.cfg file

Posted: Tue Mar 09, 2021 9:24 am
by eradicator
<NO_NAME> wrote: Tue Mar 09, 2021 7:59 am create duplicate files by a script but this is a problematic approach if someone decides to look into sources and they doesn't use Linux.
Just write the locale-generation-script in lua and include it in the mod ;).

Re: Localizing allowed_values without duplicating entries in the *.cfg file

Posted: Tue Mar 09, 2021 9:45 am
by kirazy
If you could define a LocalisedName in lua during the settings stage for allowed_values, you could resolve this easily, but it is not exposed to the API to be able to do this. Interface request time?

Re: Localizing allowed_values without duplicating entries in the *.cfg file

Posted: Tue Mar 09, 2021 3:45 pm
by <NO_NAME>
kirazy wrote: Tue Mar 09, 2021 9:45 am If you could define a LocalisedName in lua during the settings stage for allowed_values, you could resolve this easily, but it is not exposed to the API to be able to do this. Interface request time?
If there is really no way to do it right now then interface request time, sure as heck. (Both for names and descriptions of allowed_values.)

Re: Localizing allowed_values without duplicating entries in the *.cfg file

Posted: Tue Mar 09, 2021 3:58 pm
by <NO_NAME>
Could some mod move this topic to Modding interface requests board, please?