Page 1 of 1

Actor Name Localization

Posted: Fri May 08, 2015 6:34 am
by zpr
Hello,



In DS wiki http://www.pixelcrushers.com/dialogue_s ... ation.html I couldn't find an example on how to localize actor names.



I've tested like this: http://i.imgur.com/WeQUhkO.png



"Name {localize_ID}"

Actor Name Localization

Posted: Fri May 08, 2015 6:40 am
by zpr
forgot to mention it didn't work the "Name {localize_ID}"

Actor Name Localization

Posted: Fri May 08, 2015 7:28 am
by Tony Li
Hi,



The Dialogue System doesn't automatically localize actor names, but it's easy to do. Here's one way:







1. Set up localized name field exactly as you have done (e.g., "Name fr-FR").







2. Add an Override Actor Name component to the GameObject.







3. Add this script to the GameObject:

using UnityEngine;

using System.Collections;

using PixelCrushers.DialogueSystem;



[RequireComponent(typeof(OverrideActorName))]

public class LocalizeActorName : MonoBehaviour {



private IEnumerator Start() {

yield return null; // Wait 1 frame for Lua to initialize.

var overrideActorName = GetComponent<OverrideActorName>();

var initialName = string.IsNullOrEmpty(overrideActorName.overrideName) ? gameObject.name : overrideActorName.overrideName;

overrideActorName.overrideName = DialogueLua.GetLocalizedActorField(initialName, "Name").AsString;

if (string.IsNullOrEmpty(overrideActorName.internalName)) {

overrideActorName.internalName = initialName;

}

}

}

Actor Name Localization

Posted: Mon May 11, 2015 4:43 am
by zpr
Hello again,



I'm unable to get DialogueLua.GetLocalizedActorField() right. It's returning an empty string



Tested others functions and  got the following



DialogueLua.GetActorField(initialName, "Name").AsString; // returns 'Ingrid'



DialogueLua.GetActorField(initialName, "Ability").AsString; //returns 'Leadership'







My Setup:



http://i.imgur.com/3rpRc39.png



and overrideName field in OverrideActorName script is set to "Ingrid"







Edit:



I'm using DS 1.5.0 and Unity3d 4.6.4f1







EDIT:



MY MISTAKE. ALL GOOD NOW. TY