Page 1 of 1

Localize usable overrides with Unity's localization

Posted: Mon Nov 14, 2022 12:46 pm
by Pixelf0x3
Hello!

Im using the usable system of this asset as main interactuable for my project. I need to translate the names of the interactuable items (like doors, chests, and generally non actor names).

I know I can use a text table and use the key in the override field of the usable. But I was wondering if there's a way to make it work with the unity localization tables. Maybe making an item in the dialogue database (this way the name of the item appears in the unity localization tables).

If thereĀ“s currently a way to do it i'm not aware of it.

thanks in advance!

Re: Localize usable overrides with Unity's localization

Posted: Mon Nov 14, 2022 1:35 pm
by Tony Li
Hi,

Internally, the Usable component calls DialogueManager.GetLocalizedText() to look for a translation in the Text Table asset.

In the next release, I'll plan to update the Localization Package integration so it replaces DialogueManager.GetLocalizedText() with its own version that looks for a translation in the Localization Package's string tables.

In the meantime, or alternatively, you can make a subclass of Usable and override the GetName() method to pull translations from Unity's Localization Package.

Re: Localize usable overrides with Unity's localization

Posted: Tue Nov 15, 2022 11:41 am
by Pixelf0x3
Thanks for the quick response!

I that solution doesnt seem complicated, i will try.

The updates soud great, keep the good work.

Re: Localize usable overrides with Unity's localization

Posted: Sun Nov 20, 2022 1:24 pm
by Pixelf0x3
I found another solution, if anyone is interested:

I made the Usable Override name in the Usables as an autoproperty

Code: Select all

[field: SerializeField] public string overrideName { get; set; }
this way I can attach a LocalizeStrignEvent that recognizes the override name as a dynamic string.

Same thing can be done with OverrideUseMessage.



The downside is that the inspector gets poluted with extra components. For each full translated usable = TWO LocalizeStringEvents.

Also, if the language is changed when the usable UI is active, it won't update the text untill you exit and re enter the trigger area.