Select Language Term by Term

More
8 years 3 months ago #1211 by chillerVille
If all it takes to change the font is to make this assignment:

Localize.SecondaryTranslation = fontName;

... I don't find a way to get that fontName for the chosen language. :)

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

More
8 years 3 months ago - 8 years 3 months ago #1212 by Frank
Replied by Frank on topic Select Language Term by Term
Hi,

Just need to get the termData for the secondary term as well and set that:
public void OnModifyLocalization() {

		string language = m_sceneManager.GetSystemLanguage();
		string term, secondary;
		GetComponent<I2.Loc.Localize>().GetFinalTerms(out term, out secondary);
		
		var termData = LocalizationManager.GetTermData(term);
		var secTermData = LocalizationManager.GetTermData(secondary);                                   // added
		int languageIndex = LocalizationManager.Sources[0].GetLanguageIndex(language);

		if (languageIndex >= 0) {
			if (termData != null)
				Localize.MainTranslation = termData.Languages[languageIndex];
			if (secTermData != null)                                                                                                            // added
				Localize.SecondaryTranslation = secTermData.Languages[languageIndex];       // added
		}
	}

That should be work.

Also, in one of the latest versions, the CallBackTerm and CallBackSecondaryTerm was introduced to avoid having to call GetFinalTerms.
So, a simpler way its:
public void OnModifyLocalization() {

		string language = m_sceneManager.GetSystemLanguage();
		int languageIndex = LocalizationManager.Sources[0].GetLanguageIndex(language);
		if (languageIndex < 0)
			return;

                //--[ Text ]--------------
		var termData = LocalizationManager.GetTermData(Localize.CallBackTerm);
		if (termData != null)
			Localize.MainTranslation = termData.Languages[languageIndex];

                 //--[ Font ]--------------
		var secTermData = LocalizationManager.GetTermData(Localize.CallBackSecondaryTerm );
		if (secTermData != null)
			Localize.SecondaryTranslation = secTermData.Languages[languageIndex];
	}

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
Last edit: 8 years 3 months ago by Frank.

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

More
8 years 3 months ago #1213 by chillerVille

Frank wrote: Hi,

Just need to get the termData for the secondary term as well and set that:

public void OnModifyLocalization() {

		string language = m_sceneManager.GetSystemLanguage();
		string term, secondary;
		GetComponent<I2.Loc.Localize>().GetFinalTerms(out term, out secondary);
		
		var termData = LocalizationManager.GetTermData(term);
		var secTermData = LocalizationManager.GetTermData(secondary);                                   // added
		int languageIndex = LocalizationManager.Sources[0].GetLanguageIndex(language);

		if (languageIndex >= 0) {
			if (termData != null)
				Localize.MainTranslation = termData.Languages[languageIndex];
			if (secTermData != null)                                                                                                            // added
				Localize.SecondaryTranslation = secTermData.Languages[languageIndex];       // added
		}
	}

That should be work.

Also, in one of the latest versions, the CallBackTerm and CallBackSecondaryTerm was introduced to avoid having to call GetFinalTerms.
So, a simpler way its:
public void OnModifyLocalization() {

		string language = m_sceneManager.GetSystemLanguage();
		int languageIndex = LocalizationManager.Sources[0].GetLanguageIndex(language);
		if (languageIndex < 0)
			return;

                //--[ Text ]--------------
		var termData = LocalizationManager.GetTermData(Localize.CallBackTerm);
		if (termData != null)
			Localize.MainTranslation = termData.Languages[languageIndex];

                 //--[ Font ]--------------
		var secTermData = LocalizationManager.GetTermData(Localize.CallBackSecondaryTerm );
		if (secTermData != null)
			Localize.SecondaryTranslation = secTermData.Languages[languageIndex];
	}

Hope that helps,
Frank


Thanks Frank, you just made my day, and fixed the one and only problem we had with I2 Localization system. :D I've seen what they use at Ubisoft, and a couple of other companies, but your localization system work just much better. :) 100%!

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

More
8 years 3 months ago #1214 by Frank
Replied by Frank on topic Select Language Term by Term
I'm glad it's working for you now!!!

I've seen what they use at Ubisoft, and a couple of other companies, but your localization system work just much better.

It will definitely be great if they start using I2L haha
Some big companies like SGN have been using it, but the more the merrier! :-)

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.250 seconds
Template by JoomlaShine