Handle slightly different text?

More
7 years 9 months ago #2107 by JOY
Hello,

Is there any way to handle slightly different text. Ex: I have 2 texts: "This is an example localized text" and "This is an example localized text:". So the difference is only the colon ":".

Thanks,
Anh

Please Log in or Create an account to join the conversation.

More
7 years 9 months ago - 7 years 9 months ago #2109 by Frank
Hi,
Normally I suggest handling those cases by creating a simple callback script that adds the ':' to the end of the translation. And then add that script to any object that needs that modification.
inter-illusion.com/assets/I2LocalizationManual/Callbacks.html
using UnityEngine;
using System.Collections;

namespace I2.Loc
{
	public class Callback_Prefix: MonoBehaviour 
	{
		public void OnModifyLocalization()
		{
			if (string.IsNullOrEmpty(Localize.MainTranslation))
				return;
			if (LocalizationManager.IsRight2Left) 
				Localize.MainTranslation = ":" + Localize.MainTranslation;
			else
				Localize.MainTranslation = Localize.MainTranslation + ":";
		}
	}
}

However, several developers have asked me about this, and I have this exact situation in most of my projects. So I went ahead and added a Prefix and Suffix option to the Localize component. It is next to the popup to convert the case.



I uploaded the new version to the beta folder (v2.6.11 a2)

Hope that helps,
Frank

Are you :-) Give I2L 5 stars!
Are you :-( Please lets us know how to improve it!
To get the betas as soon as they are ready, check this out
Attachments:
Last edit: 7 years 9 months ago by Frank.
The following user(s) said Thank You: JOY

Please Log in or Create an account to join the conversation.

Time to create page: 0.133 seconds
Template by JoomlaShine