Page 1 of 1
I can't integrate unity localization with the dialog system
Posted: Thu Jul 21, 2022 6:16 am
by DeadLik
Hi, I can't integrate unity localization with the dialog system, according to the guide (
http://www.pixelcrushers.com/dialogue_s ... ionPackage), you need to go to Tools → Pixel Crushers → Dialogue System → Third Party → Localization → Dialogue To Localization Table, I don't have a Third Party there, how do I link localization to the dialog system?
Dialog System version 2.2.27
Re: I can't integrate unity localization with the dialog system
Posted: Thu Jul 21, 2022 8:35 am
by Tony Li
Hi,
Did you import the Plugins ► Pixel Crushers ► Dialogue System ► Third Party Support ► Localization Package Support unitypackage?
Re: I can't integrate unity localization with the dialog system
Posted: Thu Jul 21, 2022 9:19 am
by DeadLik
I would like to clarify, I can't pinpoint exactly where these add-ons are, I'm using unity 2020.3, or maybe there's a direct link to the package?
Re: I can't integrate unity localization with the dialog system
Posted: Thu Jul 21, 2022 9:37 am
by DeadLik
I found everything, thank you, I thought it would be in the tools, it turned out to be in the folder
Re: I can't integrate unity localization with the dialog system
Posted: Thu Jul 21, 2022 10:57 am
by Tony Li
Sounds good. I recommend following the
integration instructions closely. Unity's Localization package is a little complicated.
Re: I can't integrate unity localization with the dialog system
Posted: Thu Jul 21, 2022 12:03 pm
by DeadLik
Now I don't understand how to use it, is there a guide? The package has been installed, everything has been added, everything has been added to the localization table, too, but does not want to translate
At the same time, everything else is localized, something that is not related to the dialog system
Re: I can't integrate unity localization with the dialog system
Posted: Thu Jul 21, 2022 1:37 pm
by Tony Li
Hi,
If you're having trouble changing locales and getting the Dialogue System to recognize the locale change, please import the updated Localization Support package (
direct download) from the
Dialogue System Extras page.
Make sure you've added a Dialogue System Localization Package Bridge component to your Dialogue Manager GameObject, and that you've assigned the Localized String Table(s) and left the Unique Field Title set to "Guid".
Change the locale using LocalizationSettings.SelectedLocale = locale. If you're doing this in a Start or OnEnable method, remember that the Localization package requires you to wait until it has initialized. Example:
Code: Select all
private IEnumerator Start()
{
yield return LocalizationSettings.InitializationOperation;
LocalizationSettings.SelectedLocale = locale;
}
Re: I can't integrate unity localization with the dialog system
Posted: Thu Jul 21, 2022 1:57 pm
by DeadLik
Thank you, the update and initialization worked, a small question, where do you advise to initialize the language localizer?
Re: I can't integrate unity localization with the dialog system
Posted: Thu Jul 21, 2022 2:21 pm
by Tony Li
It's up to you. The bridge component will make the Dialogue System automatically use whatever you set the locale to.
I recommend initializing it in your first scene, using a Start() method like the example above. You can store the player's current localization choice in PlayerPrefs. In Start(), look up the value stored in PlayerPrefs and set the locale accordingly. Something very roughly like:
Code: Select all
public List<Locale> locales;
// Set the player's selected locale when starting:
private IEnumerator Start()
{
yield return LocalizationSettings.InitializationOperation;
if (PlayerPrefs.HasKey("Locale"))
{
int index = PlayerPrefs.GetInt("Locale");
if (0 <= index && index < locales.Count)
{
LocalizationSettings.SelectedLocale = locales[index];
}
}
}
When changing locales, also set PlayerPrefs:
Code: Select all
LocalizationSettings.SelectedLocale = locale;
PlayerPrefs.SetInt("Locale", locales.IndexOf(locale));