Page 1 of 1

Localization in Inventory engine support

Posted: Wed Oct 04, 2023 3:17 am
by balsamina
Hello, I am writing to you because I have a question about localization in the inventory support of the dialogue system. I unpacked the inventory engine support as indicated on the homepage, assigned the dialogue manager prepab to the ui manager, and even made a text table, but I don't know what text table to make. I want to localize "ItemName" and "Description" in multiple languages among the items in the inventory engine, should I create a text table named "ItemName" and "Description"? I'm sorry if it's an inexperienced question. Thank you always,
https://www.pixelcrushers.com/dialogue_ ... ngine.html

Re: Localization in Inventory engine support

Posted: Wed Oct 04, 2023 8:21 am
by Tony Li
Hi,

Create a text table (Assets > Create > Pixel Crushers > Common > Text Table) and name it whatever you want. Assign it to the Dialogue Manager GameObject's Display Settings > Localization Settings.

Then create two fields for each item: one that matches the item's name, and another that matches its description:

ieLocalization.png
ieLocalization.png (12.09 KiB) Viewed 334 times

Re: Localization in Inventory engine support

Posted: Wed Oct 04, 2023 8:54 am
by balsamina
Thank you for answer! Thanks to you, I found a solution to the problem, but when I created and applied a text table, it seems that even if I change the language settings, the changed language is not applied and only the default language is displayed. Do I need to add the Localize UI component to inventory details? Unity localization package integration has already been completed.

Re: Localization in Inventory engine support

Posted: Wed Oct 04, 2023 9:51 am
by Tony Li
Hi,

The Dialogue System's Inventory Engine integration does not use Unity's Localization Package.

If you have already set a language, the language value may be stored in PlayerPrefs. To reset it, click the Dialogue Manager's Localization Settings > Reset Language PlayerPrefs. Then the Dialogue System will recognize the language you have specified in Localization Settings.

Re: Localization in Inventory engine support

Posted: Wed Oct 04, 2023 10:44 am
by balsamina
Thank you, I almost solved my problem. Sorry to bother you, but I have one last question. What code should I write to change the in-game language settings by clicking a specific button in the game? I am not sure which function should be used with code such as DialogueManager.SetLanguage( "es" );, which is shown as an example on the homepage. Could you please give me a simple example? If this is a bothersome question, feel free to ignore it.

Re: Localization in Inventory engine support

Posted: Wed Oct 04, 2023 10:52 am
by Tony Li
That line of code is correct. You could write a script and add it to a UI Button to call that line of code. For example:

Code: Select all

using UnityEngine;
using UnityEngine.UI;
[RequireComponent(typeof(Button))]
public class SetLanguageButton : MonoBehaviour
{
    public string languageCode; // <-- SET IN INSPECTOR
    void Start()
    {
        GetComponent<Button>().onClick.AddListener(() => PixelCrushers.DialogueSystem.DialogueManager.SetLanguage(languageCode));
    }
}
Add this to a UI Button and set the Language Code field. You don't need to confgure the OnClick() UnityEvent. The script will take care of that.

Re: Localization in Inventory engine support

Posted: Wed Oct 04, 2023 11:25 am
by balsamina
I'm very sorry, but when I pasted the code you provided, the result was "Assets\Scripts\SetLanguageButton.cs(13,62): error CS0234: The type or namespace name 'DialogueManager' does not exist in the namespace 'PixelCrushers' (are you missing an assembly reference?)” error occurs. I don't know much about coding, so I don't know which part to fix. I would really appreciate your help...

Re: Localization in Inventory engine support

Posted: Wed Oct 04, 2023 11:37 am
by Tony Li
I had a typo. Try it now.

Re: Localization in Inventory engine support

Posted: Wed Oct 04, 2023 11:43 am
by balsamina
Ah, it finally works! Thank you so much for your help. Have a nice day!

Re: Localization in Inventory engine support

Posted: Wed Oct 04, 2023 12:01 pm
by Tony Li
Glad to help!