1. Add the DialogueSystemLocalizationPackageBridge component to your Dialogue Manager.
2. Make a subclass of the Menu System's Options class. Override the SetLanguageByIndex() method (at the bottom of the script) to set the Localization Package's Locale. When you set the Localization Package's Locale, the DialogueSystemLocalizationPackageBridge will automatically set the Dialogue System's localization, too.
OptionsWithLocalizationPackage.cs
Code: Select all
using UnityEngine;
using UnityEngine.Localization;
using UnityEngine.Localization.Settings;
namespace PixelCrushers.DialogueSystem.MenuSystem
{
public class OptionsWithLocalizationPackage : Options
{
base.SetLanguageByIndex(index);
// Get the available locales from Unity's Localization Package:
var locales = LocalizationSettings.AvailableLocales.Locales;
if (0 <= index && index < locales.Count)
{
// Set the selected locale:
LocalizationSettings.SelectedLocale = locales[index];
}
else
{
Debug.LogWarning("Invalid language index.");
}
}
}