Before I buy - will I be able to localize lists?

More
7 years 8 months ago - 7 years 8 months ago #1713 by Sarr
A quick 2 questions:

1. Is there some more "automatic" way to access terms in categories through code?
I have it this way:
public string ParseAndLocalize( string text )
	{
		string[] separators = {",", ".", "!", "?", ";", ":", " "};
		var arrayItems = text.Split(separators, StringSplitOptions.RemoveEmptyEntries);    // divides the text into each element
		var translatedTerms = arrayItems.Select(x=>ScriptLocalization.Get(x)).ToArray();    // translate each of those elements
		return string.Join(", ", translatedTerms);   // for English, it returns "Sword, Chain mail, Shield"
	}

	public void OnModifyLocalizationArmors()
	{
		Localize.MainTranslation = string.Join (", ", armorProfList.Select (x => ScriptLocalization.Get (x)).ToArray ());
	}

	public void OnModifyLocalizationWeapons()
	{
		Localize.MainTranslation = string.Join (", ", weaponProfList.Select (x => ScriptLocalization.Get (x)).ToArray ());
	}

etc. etc. about 5 more times
And just thought I'd put every term into its own category... Which was probably a mistake, seems my above code doesn't find terms now and I get only ", ".
Guess I would need to edit ParseAndLocalize for each and every category I have to probably something like this:
(...) (x => ScriptLocalization.Equipment.Get (x)).ToArray ());
And of course every function would need different name. But that's probably not worth the work and time... Would need to have about 10 different custom-pathed ParseAndLocalize functions and at least 7 custom-pathed OnModifyLocalization, each for 1 category. And that's only a start.
Maybe better to have one big google spreadsheet and "categorize" the content by using bold font, or something... Categories for 10-40 terms look good in UI, but seem like a lot of unnecasary work in code when parsing/localizing.
Or maybe you could invent some "keyword" to put after ScriptLocalization. to make your system find a term no matter in which category it is?
Other idea would be to add some only "visual" categories just for UI in I2 Loc prefab. This way we would have nice order inside Unity Editor, but could access terms from default category.

2. How do I access a term in category when it's named like this: Weapon & Armor proficiencies?
Last edit: 7 years 8 months ago by Sarr.

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

More
7 years 8 months ago #1714 by Frank
A categorized term has this format: "Category/Term" . You could even have nested categories "Category1/SubCategory/term"

In your case, a term named "Weapon & Armor proficiencies" belonging to a category named "Equipment" is actually written as:
"Equipment/Weapon & Armor proficiencies"

That way, you don't need to modify the ParseAndLocalize function.
You just need to add the term "Equipment/Weapon & Armor proficiencies" to your armorProfList instead of adding just "Weapon & Armor proficiencies"

Your list should be something like:
{ "Equipment/Weapon & Armor proficiencies", "Equipment/Weapon1", "Skill/Skill1" } etc

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

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

More
7 years 8 months ago #1723 by Sarr
Just posting to let you know everything works great and I2 Localization is absolutelty amazing :).
Already having working translation, parameters are working too, so we didn't need to split text objects or insert variables, just parameters.
Now we're just moving on with the project and will contact you when it's complete. Will be writing a really positive review in Unity Asset store soon, not forgetting about your outstanding support and continous development of this software.

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

Time to create page: 0.171 seconds
Template by JoomlaShine