Page 1 of 1
Localization problem
Posted: Sat Aug 29, 2020 5:51 pm
by Pi-C
I'm currently working on the localizations of Bio Industries.
Code: Select all
[fluid-name]
bi-biomass=Algen-Biomasse
[item-name]
fertiliser=Düngemittel
[recipe-name]
bi-biomass-1=Produktion von Algen-Biomasse mit __ITEM__fertiliser__
bi-biomass-2=Produktion von __FLUID__bi-biomass__ mit __ITEM__fertiliser__
The string for recipe-name.bi-biomass-1" will be displayed correctly, with __ITEM__fertiliser__ being replaced by the string set in item-name.fertiliser. The same thing doesn't work with fluids, though. The string for recipe-name.bi-biomass-2 will be just the placeholder __FLUID__bi-biomass__ i.e., __FLUID__bi-biomass__ wont be replaced with fluid-name.bi-biomass. I guess it should be possible somehow to reference the names of different fluids -- but how is it done?

Re: Localization problem
Posted: Thu Mar 25, 2021 4:56 pm
by Pi-C
OK, I can change the string in recipes by using
Code: Select all
[fluid-name]
bi-biomass=Algen-Biomasse
[item-name]
fertiliser=Düngemittel
[recipe-name]
bi-biomass-2=Produktion von __1__ mit __ITEM__fertiliser__
in the locale file and
Code: Select all
recipe.localised_name = {"recipe-name.bi-biomass-2", {"fluid-name.bi-biomass"}}
in the recipe definition. But how about mod-settings? There's no other place where I could pass on the fluid name as an argument. Do I really have to jump through hoops, e.g. declaring a dummy item and use
Code: Select all
data.raw.item[fluid_name].localised_name = {"fluid-name.X"}
and then use
Code: Select all
bi-biomass-2=Produktion von __ITEM__X__ mit __ITEM__fertiliser__
in the locale?
Re: Localization problem
Posted: Thu Mar 25, 2021 5:16 pm
by Bilka
Pi-C wrote: Thu Mar 25, 2021 4:56 pm
But how about mod-settings?
localised name like recipe? Your post doesn't really give context as to why that wouldnt work.
Re: Localization problem
Posted: Thu Mar 25, 2021 6:38 pm
by Pi-C
Bilka wrote: Thu Mar 25, 2021 5:16 pm
Pi-C wrote: Thu Mar 25, 2021 4:56 pm
But how about mod-settings?
localised name like recipe? Your post doesn't really give context as to why that wouldnt work.
In the locale file, it's only possible to use __ENTITY__entity-name__ and __ITEM__item-name__, but not __FLUID__fluid-name__:
Code: Select all
[fluid-name]
bi-biomass=Biomasse
[item-name]
fertilizer=Düngemittel 08/15
[recipe-name]
bi-biomass-2=Produktion von __FLUID__bi-biomass__ mit __ITEM__fertilizer__
will give you this:

- fluid-name.png (23.14 KiB) Viewed 1994 times
Work-around for recipes:
Code: Select all
[fluid-name]
bi-biomass=Biomasse
[item-name]
fertilizer=Düngemittel 08/15
[recipe-name]
bi-biomass-2=Produktion von __1__ mit __ITEM__fertilizer__
data:extend({
{
type = "recipe",
name = "bi-biomass-2",
localised_name = {"recipe-name.bi-biomass-2", {"fluid-name.bi-biomass"}},
…
}
})
This will work as expected because {"fluid-name.bi-biomass"} is passed on as an argument directly in the recipe's localized name:

- fluid-name-2.png (22.2 KiB) Viewed 1994 times
But it wouldn't work for mod settings:
Code: Select all
[mod-setting-name]
BI_Bio_Fuel=Aktivieren: __FLUID__bi-biomass__

- settings.png (41.68 KiB) Viewed 1994 times
Using "__1__" instead of "__FLUID_bi-bio-mass__" is no option here because there's no way to pass on an argument externally. However, it does work with item names:
Code: Select all
[mod-setting-name]
BI_Bio_Fuel=Aktivieren: __ITEM__fertilizer__

- settings-2.png (43.02 KiB) Viewed 1994 times
Re: Localization problem
Posted: Thu Mar 25, 2021 6:44 pm
by ickputzdirwech
EDIT: looks like I was a bit slow
I would guess he means string settings with allowed values like {"fluid-1", "fluid-2}. Since you can't define a localised name for the allowed values in the prototype you couldn't use
[string-mod-setting]
setting-name-fluid-1=__1__
setting-name-fluid-2=__1__
As a workaround (since __FLUID__fluid-name__ unfortunately doesn't exist) you could try something like
[item-name]
dummy-fluid-1=Fluid 1
dummy-fluid-2=Fluid 2
[string-mod-setting]
setting-name-fluid-1=__ITEM__dummy-fluid-1__
setting-name-fluid-2=__ITEM__dummy-fluid-2__
May I also point to this question around the same issue:
90493. I wish there were some more built in parameters like __TECHNOLOGY__ and __RECIPE__.
Re: Localization problem
Posted: Thu Mar 25, 2021 7:10 pm
by Bilka
Pi-C wrote: Thu Mar 25, 2021 6:38 pm
But it wouldn't work for mod settings: Using "__1__" instead of "__FLUID_bi-bio-mass__" is no option here because there's no way to pass on an argument externally.
Yes, there is, as I said. localised_name on the prototype, just how you did it with the recipe.
Re: Localization problem
Posted: Sat Mar 27, 2021 7:34 am
by Pi-C
Bilka wrote: Thu Mar 25, 2021 7:10 pm
Pi-C wrote: Thu Mar 25, 2021 6:38 pm
But it wouldn't work for mod settings: Using "__1__" instead of "__FLUID_bi-bio-mass__" is no option here because there's no way to pass on an argument externally.
Yes, there is, as I said. localised_name on the prototype, just how you did it with the recipe.
Oh, my… That was so obvious, wasn't it? Thanks for the reminder!
ickputzdirwech wrote: Thu Mar 25, 2021 6:44 pm
May I also point to this question around the same issue:
90493. I wish there were some more built in parameters like __TECHNOLOGY__ and __RECIPE__.
I still agree with this, however. Couldn't it be made that we could use parameter __X__for every pair of vanilla categories "[X-name] and [X-description]"? It would be so much easier as one would not see anonymous parameters (__1__ etc.) in the strings, but could get the context immediately, without having to switch to another file.
Re: Localization problem
Posted: Sat Mar 27, 2021 8:41 am
by ickputzdirwech
And even though it isn’t the issue Pi-C is having: It doesn’t work for the options of string mod settings. You can’t define a localised name for them in the prototype.
(I did a mistake in my post above. I edited and it should be correct now.)