Right to Left Text problem in Dialogue System

More
5 years 8 months ago #3197 by fanaei
Hi. I'm using I2 Localization + Dialogue System
The I2 localization shows the RTL languages like Arabic texts fine. But when I use it with Dialogue system, all the letters get separated and in a wrong direction.
How can I fix this problem?

Thanks in advance

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

More
5 years 8 months ago #3198 by Frank
Hi,
How are you using I2 Localization + Dialog System.
By default Dialog System has a built-in localization and doesn't use I2 Localization. Integrating both plugins is possible, and there are several users who are using both at the same time.

I'm curious about how you are using them together. The fix for that issue will depend on how you integrate them.

Are you adding a Localize component to your Texts and made Dialog System call SetTerm ?
Are you handling all by code and calling LocalizationManager.GetTranslation when Dialog System needs a translation?

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
The following user(s) said Thank You: fanaei

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

More
5 years 8 months ago #3201 by fanaei
I didn't know that Dialogue system has localization. But I feel more comfortable with I2 localization.
Also I did the integration based on this guide:
www.pixelcrushers.com/dialogue_system/ma...i2_localization.html

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

More
5 years 8 months ago - 5 years 8 months ago #3202 by fanaei
I found some fixes here:
pixelcrushers.com/phpbb/viewtopic.php?f=3&t=1590&p=8595#p8595
If you have nay better solution, I'm all ear.
Last edit: 5 years 8 months ago by fanaei.

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

More
5 years 8 months ago #3203 by fanaei
The code that I used for fixing RTL problem in the main Dialogue System UI:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using PixelCrushers.DialogueSystem;

public class FixFarsi : MonoBehaviour {
	public int TextLimit = 999;
	void OnConversationLine(Subtitle subtitle)
	{
		subtitle.formattedText.text = I2.Loc.LocalizationManager.ApplyRTLfix (subtitle.formattedText.text, TextLimit, false);
	}

	void OnConversationResponseMenu(Response[] responses)
	{
		for (int i = 0; i < responses.Length; i++) {
			responses [i].formattedText.text = I2.Loc.LocalizationManager.ApplyRTLfix (responses [i].formattedText.text, TextLimit, false);
		}
	}
}

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

More
5 years 8 months ago #3204 by Frank
Hi,
Unfortunately, I don't have the Dialog System plugin to inspect the code, but from what I'm reading in the integration steps you listed:
www.pixelcrushers.com/dialogue_system/ma...i2_localization.html

That's not actually integrating I2 Localization with Dialog System. That keeps using the Dialog System localization and just uses I2 Localization as a way to translate terms in the editor or sync with Google Spreadsheet. But none of the runtime features of I2 Localization are used (except for reading the CurrentLanguage string).

That works fine if you just need the translations done, and the code you posted should work fine for fixing RTL issues.

But if you need more features (e.g. Parameters-> to dynamically change the player's name or other data, Plurals, etc) then the integration should be done a bit different.

Instead of storing the actual text in Dialog System, you should save the Term's name, and then whenever you do
formattedText.text = xxx.formattedText.text

you can do:
formattedText.text = I2.Localization.GetTranslation(xxx.formattedText.text)

That way, parameters, plurals, rtl fix, etc is automatically handled at runtime by I2 Localization.
And even better, if you link Google Spreadsheets with I2L, then if you change a translation in the spreadsheet, that change is automatically downloaded and used in your player's devices without deploying a new build.

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

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

Time to create page: 0.162 seconds
Template by JoomlaShine