elmortem / localization

Simple localization system
The Unlicense
1 stars 1 forks source link

Non-obvious requirement to use the Resources folder #3

Open Red-Cat-Fat opened 3 months ago

Red-Cat-Fat commented 3 months ago

When trying to load localization from Google sheets, I encountered an error:

ArgumentOutOfRangeException: Length cannot be less than zero.

While studying the question, I saw that inside LocalizeSettings, in the OnValidate method, there is a line

LocalizeSettings.cs:68
var startLength = "Assets/Resources/".Length;

But since this was a demo project to learn how the package works, the localization file was just along the Assets path. I think that it is worth showing a welcome window at the time of creating localization, which will create localization automatically in the right places. I think this can be done in the LocalizeSettings search location inside MakeInstance, if we didn't find anything.

Red-Cat-Fat commented 3 months ago

Also, this error caused empty links to be recorded in Locales and do not allow updating even after moving to the Resources folder. image

I think you should somehow limit the ability to create prefabs anywhere. I.e. remove [CreateAssetMenu] from all files, shifting all creation to a separate window.