Does it Support Unity's Localization?

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
cassius
Posts: 14
Joined: Thu Oct 26, 2023 10:30 pm

Does it Support Unity's Localization?

Post by cassius »

Hi,

This asset looks great from what I've seen so far, but I'm wondering if it supports Unity's Localization plugin? Most of the message board threads I've read here indicate the Dialogue System for Unity has its own localization instead.

Thanks,
Cassius
User avatar
Tony Li
Posts: 22112
Joined: Thu Jul 18, 2013 1:27 pm

Re: Does it Support Unity's Localization?

Post by Tony Li »

Hi,

The Dialogue System supports Unity's Localization package, i2 Localization,and its own localization (which is useful if you're localizing your content in a third party app such as articy:draft, or if you prefer the Dialogue System's more straightforward localization system).

Info on all of them: Localization
cassius
Posts: 14
Joined: Thu Oct 26, 2023 10:30 pm

Re: Does it Support Unity's Localization?

Post by cassius »

Thanks for the reply and for the link.

Is it possible there are some steps missing from the documentation (specifically about Unit's Localization module)? I ran through it 3 times but I don't see any translations happening when I select a different language in the Localization drop down in the Player. I can see the translations added to my Localization tables with the UID and text. So things are good up to that point but the table doesn't seem to be used by anything. The "Dialogue System Localization Package Bridge" component is on the Dialogue Manager. I also tried copying one of the UI Templates and adding LocalizeEventStrings to the text objects, but they don't get updated.

Any ideas what may be going wrong?

BTW the asset is looking awesome so far!

Thanks,
Cassius
User avatar
Tony Li
Posts: 22112
Joined: Thu Jul 18, 2013 1:27 pm

Re: Does it Support Unity's Localization?

Post by Tony Li »

Hi Cassius,

Did you use the "DS To Loc" window to populate your Localization Package string tables with your dialogue database's content?

For each dialogue entry, for example, you should see an entry in the string table that's a GUID similar to the ones shown below:

localizationTable.png
localizationTable.png (58.11 KiB) Viewed 539 times

It will also add a Guid field to each dialogue entry that matches the string table entry:

localizationGuids.png
localizationGuids.png (157.88 KiB) Viewed 539 times

There's no need for any other components to localize dialogue content. The Dialogue System Localization Package Bridge component on the Dialogue Manager will pull translations out of the string table at runtime as needed.
cassius
Posts: 14
Joined: Thu Oct 26, 2023 10:30 pm

Re: Does it Support Unity's Localization?

Post by cassius »

Yes, I have used the "DS To Loc" window to populate things. The data does show up correctly in the Table Collection, so that's all good.
(ignore that this particular screen shot only has 1 translation in english... I've been running through tests)
1.png
1.png (76.83 KiB) Viewed 536 times
The Guid field also does show that the entry matches from the string table entry:
2.png
2.png (92.25 KiB) Viewed 536 times
Switching system languages in the Play mode field has no impact. Ex: If I choose French as the default language, populate the Table Collection using "DS To Loc" and then hit play, I still get all the French text even though my system is set for English. (apologies if I'm being verbose).

So that I understand workflow - does the Dialogue System for Unity become the source-of-truth for the text fields and translations rather than Unity's Localization package?
User avatar
Tony Li
Posts: 22112
Joined: Thu Jul 18, 2013 1:27 pm

Re: Does it Support Unity's Localization?

Post by Tony Li »

The DialogueSystemLocalizationPackageBridge script hooks into the UnityEngine.Localization.Settings.LocalizationSettings.SelectedLocaleChanged event. When you change locales, it will set the Dialogue System's internal language setting to the same as LocalizationSettings.SelectedLocale.Identifier.Code.

How are you switching languages? Is it switching the Localization package's current language?
cassius
Posts: 14
Joined: Thu Oct 26, 2023 10:30 pm

Re: Does it Support Unity's Localization?

Post by cassius »

Thanks for the replies.

Hmm, interesting. Then I'm not sure why it's not updating.. To answer your question, I'm doing it through the Localization module's Play-mode drop down menu. That updates my traditional "non-Dialogue System for Unity" text fields though, so the update is getting passed down. I guess I'm not sure why DialogueSystemLocalizationPackageBridge isn't seeing it.
3.png
3.png (417.05 KiB) Viewed 535 times
It seems that

Code: Select all

OnSelectedLocaleChanged()
in DialogueSystemLocalizationPackageBridge is getting triggered for me as expected, and the value in

Code: Select all

Localization.language
is getting set correctly too when I change it too.
User avatar
Tony Li
Posts: 22112
Joined: Thu Jul 18, 2013 1:27 pm

Re: Does it Support Unity's Localization?

Post by Tony Li »

Hi,

I can confirm that the LocalizationSettings.SelectedLocaleChanged event is being invoked when changing the locale through that dropdown menu, and it changes the localization language used by the Dialogue System.

Can you send a reproduction project to tony (at) pixelcrushers.com?

Alternatively, open the DialogueSystemLocalizationPackageBridge.cs script in your code editor and set a breakpoint on the first line of the OnSelectedLocaleChanged(Locale) method. When you play and use the dropdown menu, the game should stop at that breakpoint.
cassius
Posts: 14
Joined: Thu Oct 26, 2023 10:30 pm

Re: Does it Support Unity's Localization?

Post by cassius »

Thanks. I've sent it over to you.
User avatar
Tony Li
Posts: 22112
Joined: Thu Jul 18, 2013 1:27 pm

Re: Does it Support Unity's Localization?

Post by Tony Li »

Hi,

Thanks for sending the reproduction project and the follow-up email clarifying what you're looking to do. I replied to your email with an updated package named DS_LocalizationPackageSupport_2023-10-29.unitypackage.
Post Reply