Bugs and feedback

More
3 years 8 months ago - 3 years 8 months ago #1152 by Sycobob
Replied by Sycobob on topic Bugs and feedback
I just tested with 2.6.2 b2 and recorded another video. This time I used only a single inspector.



At 0:35 you'll see changing the Category on a Term still causes the Term to break. It creates a new, empty copy of the Term and leaving the old Term orphaned. Anything that was using the uncategorized Term is now using the empty new Term.

Renaming at 1:10 appears to have worked properly.

Regarding the parsing, I believe you're misunderstanding the issue. It's not a matter of the terms list being out of date because it's cached. The problem is that I'm explicitly clicking Parse Localized Terms and it's not finding any of the 'used but unsaved' Terms in scene, even on objects that are enabled. In the first video you can see I save and reopen the scene at 2:08. After doing this, all the 'used but unsaved' Terms disappear. Even when explicitly parse the scene, none of these Terms are ever found again. This leaves a bunch of unreachable Terms in the scene. The same thing occurs in the new video at 1:40.

Some other minor stuff:
The round arrow icon on the refresh button in your screenshot doesn't show up for me.
If you notice, the filter in Terms resets a couple times. It would be convenient if this persisted.
There are unnecessary scroll bars in the Terms list. This clips some of the content.
Description text on Terms doesn't wrap. If it gets too long, it runs off the sides of the Inspector.

i.imgur.com/VrM3MV4.png

For the record, I'm using Unity 5.2.3f1, if you're using a different version, perhaps they are behaving differently.

Thanks Frank, I appreciate the help and quick turnaround.

EDIT: Since you mentioned not being able to find disabled objects, I figured I'd mention Resources.FindObjectsOfTypeAll<T>(). As opposed to Object.FindObjectsOfType<T>() this will find inactive objects. The downside is that it also finds assets (prefabs and such) so you have to manually filter those out. I'm sure this has a performance and memory impact, but even on my extremely large project that doesn't seem to cause much of an issue. I would say it's rather desirable to be able to find all Localize scripts in the scene, regardless of their enabled state. Here's a quick example:
public static List<T> GetAllObjectsInScene<T> ( bool includeInactive = true ) where T : Component
{
	if ( !includeInactive )
		return UnityEngine.Object.FindObjectsOfType<T>().ToList();

	var compsInScene = Resources.FindObjectsOfTypeAll<T>().ToList();

	compsInScene.RemoveAll((component) =>
	{
		//Reject hidden objects in the scene (Unity creates a few of these in the background).
		const HideFlags hidden = HideFlags.HideInHierarchy & HideFlags.HideInInspector;
		bool isHidden = (component.hideFlags & hidden) != 0;

		//Reject assets that aren't in the scene
		PrefabType prefabType = PrefabUtility.GetPrefabType(component);
		bool isPrefab = prefabType == PrefabType.Prefab
		             || prefabType == PrefabType.ModelPrefab;

		return isHidden || isPrefab;
	});

	return compsInScene;
}
Last edit: 3 years 8 months ago by Sycobob.

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

More
3 years 8 months ago #1157 by Frank
Replied by Frank on topic Bugs and feedback
Hi,
Thanks for taking the time to test the plugin and document the issues you found, that helped me remove quite a few!
I just uploaded version 2.6.2 b3 that should fix all the issues you mentioned:

The filter will no longer reset
Description and Language translations TextField now uses Word wrap to avoid
Removed extra scrollbars when not needed, and adjusted the positions when displayed to avoid clipping
Renaming and Categorizing should be far more stable now
Parsing will detect all terms

Also I added a few other fixes that were reported by other users and improved the unity 5 integration by removing some warnings and in 5.3 that it was failing to create some folders when opening for the first time.
Plus, there is now Android store integration (adding strings.xml for each language so the app store could show that the app has been localized). IOS will be implemented next.

EDIT: Since you mentioned not being able to find disabled objects, I figured I'd mention Resources.FindObjectsOfTypeAll<T>()


Thanks for posting the code. I actually was using the same approach.
But after some debugging when reproducing your steps, I found that the issue was caused by inferred terms (those that take the term name from the label's text) that were not detected until they got initialized the first time they are selected.

I fixed that and Parsing and parsing behaves now as expected (I will continue testing over the weekend, but so far seems to be stable)

The round arrow icon on the refresh button in your screenshot doesn't show up for me.


That's quite strange, the icon is actually just a unicode font character. So I guess my window is using a different version of the font than yours. I will try reproducing that in another computer and find a similar character that has better support.
If not I will just add a texture, but I try to avoid that given that they have to be in the resources folder and so they are added to your builds size.


Again, Thanks a lot for all the testing!!
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.

More
3 years 8 months ago #1158 by Sycobob
Replied by Sycobob on topic Bugs and feedback
I just finished giving 2.6.2f1 a go. It looks like everything you mentioned is now working well except changing Term Categories.

When changing a Category, the new Term is created properly and has all the correct data, but Localize scripts in the scene that are using the Term don't get updated. This may only affect Localize scripts with inferred Terms, I haven't tested with explicitly assigned Terms. For example:
  • I have a Localize component with an inferred Term (let's call it "Back") and the Term does not exist in the Language Source
  • I add the Term to the Language Source, (the Localize component remains inferred)
  • I change the "Back" Term Category from none to GUI
  • The "Back" Term is copied properly to "GUI/Back"
  • The Localize component stays in the inferred state, looking for and not finding "Back"
  • Now the Language Source shows a properly configured "GUI/Back" Term, and a 'used but not saved' "Back" Term

So by changing the Category of a Term I end up with Localize components that were previously working no longer being localized properly.

Overall, this inferred Term feature seems to introduce a lot of gotchas in return for a questionable benefit. What do you think of the suggestions I made previously about automatically changing inferred Terms to full links during some specific actions?

1) Assume you have an unlocalized Text component. You add a Localize script. The script defaults to an [inferred] state and uses the current text content as the Term. You click Add Term to Source. When you do this, all Localize scripts using this same [inferred] Term become fully linked to the Term when it's added to the Source.

2) Assume you have an unlocalized Text component. You add a Localize script. When added, the Localize script checks the Source and if there is a Term that uses the exact text content, it becomes fully linked to the existing Term.


In addition, I'd like to suggest that inferred Terms look for matching Terms with Categories, instead of only using Terms with an empty/default Category. In the above example, since no "Back" Term exists, the Localize component would find the "GUI/Back" Term and use that. If there are multiple "Back" Terms maybe it stays inferred to force developer to resolve the ambiguity.

I've also noticed there's a hard-coded path used when generating the ScriptLocalization file. I've added a quick hack locally to find the path dynamically. We organize our assets folder with external assets separated from our internal code. In LocalizationEditor_Tools_Source.cs
Line 15
//const string ScriptLocalizationFileName = "/I2/Localization/Scripts/ScriptLocalization.cs";
const string ScriptLocalizationClassName = "ScriptLocalization";

BuildScriptWithSelectedTerms Line 74
sb.Append("	public static class "); sb.AppendLine(ScriptLocalizationClassName);

BuildScriptWithSelectedTerms Line 85
//*
string thisFilePath = new StackTrace(true).GetFrame(0).GetFileName();
string targetDirPath = new DirectoryInfo(thisFilePath).Parent.Parent.Parent.FullName;

string targetFilePath = string.Format("{0}{1}{2}.cs", targetDirPath, Path.DirectorySeparatorChar, ScriptLocalizationClassName);
System.IO.File.WriteAllText(targetFilePath, sb.ToString(), System.Text.Encoding.UTF8);

string assetsDirPath = new DirectoryInfo(Application.dataPath).FullName;
string relativeTargetPath = targetFilePath.Replace(assetsDirPath, string.Empty);
AssetDatabase.ImportAsset("Assets" + relativeTargetPath);
//*/

/*
string ScriptFile = Application.dataPath + ScriptLocalizationFileName;
System.IO.File.WriteAllText(ScriptFile, sb.ToString(), System.Text.Encoding.UTF8);
AssetDatabase.ImportAsset("Assets"+ScriptLocalizationFileName);
//*/

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

More
3 years 8 months ago - 3 years 8 months ago #1159 by Frank
Replied by Frank on topic Bugs and feedback
Hi,
Its true that most of the time, those points you suggested are the expected behavior, so I added them into the new version (2.6.3 a1).

NEW: If the localize component, can find its inferred term in a source (even on a different category), it will use that term and stop inferring it
NEW: When adding a term to a source, the scene is parsed and every object inferring that term will start using it
NEW: In LanguageSource inspector, button "Add Terms" and "Remove Term" will use the selected term even if it doesn't have the checkbox ticked
NEW: When auto-generating ScriptLocalization.cs, if the file was moved, the plugin finds it and regenerate it in the new location

I also changed the ScriptLocalization generation to account for when the file is moved. So you can move it now to any location that fits better with your project!

Hope that helps!
Frank

BTW, I just uploaded version 2.6.3 a1 to the beta folder.

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

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

More
3 years 8 months ago #1160 by Sycobob
Replied by Sycobob on topic Bugs and feedback
Thanks Frank, you rock

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

More
3 years 8 months ago #1161 by Frank
Replied by Frank on topic Bugs and feedback
You are very welcome!
And thank YOU for taking the time to test the plugin and send me all the detailed bug reports and suggestions, that helped a lot!!

Please, don't hesitate in letting me know of anything else that could be improved to help make the plugin more helpful to your project.
Thanks!
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.141 seconds
Template by JoomlaShine