Some Keys Won't Compile as C# Identifiers

More
9 years 3 weeks ago - 9 years 3 weeks ago #581 by JAC
Hey I2 Team/Frank,

We're hooking up localization for our next game here, and we're looking at using your I2 Localization extension and getting licensees for the rest of the team here.

It's a well made tool, nice work.

One minor issue with it, is by default when making keys from an unlocalized text field it uses the contents of that text field verbatim. I see that you can override that by expanding the Terms and typing it in search, but it's an easy mistake to make, and not trivial to fix if that's not an appropriate key. It'd be nice if you could more easily rename keys and update references, but that's likely not trivial, and a lesser issue.

It's a problem if you use a key that isn't also a valid C# identifier and want to build script with that term in it from Language Source>Tools>Script>"Build Script with Selected Terms". It uses the key names as field names, verbatim; including spaces and punctuation. So if your key came from an existing text field, it probably won't compile.

It'd be nice if it would sanitize keys to be valid identifiers when building ScriptLocalization. Replace spaces with underscores, remove apostrophes, etc.


Also as trival nicety, it'd be nice if there was an option to hide the big bold titles on the component inspectors. They use a lot of space and they're a little redundant for us.

Thanks,
Jovanni
Last edit: 9 years 3 weeks ago by JAC.

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

More
9 years 3 weeks ago #582 by Frank
Hi,
Indeed if you build the ScriptLocalization.cs with the default label's texts it could make an invalid cs file.
I just added a fix for that and also added an option to specify the maximum length allowed (C# uses 511 as its identifier limit, but you can now set whatever limit fits better for your project)

Also, all Terms that become the same string after removing the invalid characters are sequentially numbered (This_is_1, This_is_2, etc).

Also as trival nicety, it'd be nice if there was an option to hide the big bold titles on the component inspectors. They use a lot of space and they're a little redundant for us.


I just added an option to remove the title in the Localize component and the Language Source component.
Nonetheless, you can manually remove that text by commenting out line 73-77 in the I2\Localization\Scripts\Editor\Inspector\LocalizeInspector.cs

so that it looks like:
			GUI.backgroundColor = Color.white;

			//if (GUILayout.Button("Localize", GUIStyle_Header))
			//{
			//	Application.OpenURL(HelpURL_Documentation);
			//}
			//GUILayout.Space(-10);

			LocalizationManager.UpdateSources();


This changes are now on version 2.4.5 b1 which I will release later today. You can get those beta version from the community release page.

Hope that helps and please let me know of any other issue or suggestion you may find :-)
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
9 years 3 weeks ago #583 by JAC
Impressive support. Thanks Frank!

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

Time to create page: 0.215 seconds
Template by JoomlaShine