Hello,
I tried a bit the package a year ago, and started playing again with it recently. The version was 0.6 at the time and is now 0.11 so I had to deal with some changes in the api.
The current package workflow is to add a component next to any component you want to localize (using the “Localize” right click shortcut). Then set the localization table entry using the localization component, or using the localization table editor window then set up the link in the component.
And this really tedious.
That also mean you can’t localize string within ScriptableObject. You can duplicate the ScriptableObject for each locale and use them as localized assets. But it implies manual updates, which is tedious as well.
Also not sure it allows to reuse stuff like prefabs from a project to another, as it would break all addressable links so you have to set up the localization again almost from the start. It is still work in progress, but here is a view of its current state (for text mesh pro components) :
First a shortcut to change the application current locale, that trigger a refresh (reload) of any localized stuff. I also made it working in editor (for both play or editor).
The second element is a unity event connected on the locale change.
The third element is a list of target and reference. Target is the unity component I want to localize. Reference is the localization package LocalizedReference class instance.
Fourth are buttons that applies on the previous element collection, for the current locale : LoadAll to refresh all component (so read the addressable database) and save to overwrite all component values.
It allows to save the changes after scene/prefab modification.
Next is the roots list. They are the gameobjects whose hierarchy will be scan to find all TextMeshPro components and will populate the following list.
Sixth if the preset list, populated from the root list when the scan button is pressed.
A preset is a candidat entry for the third element (list of Component/LocalizedReference). This is an editor authoring tool which let you previsualize what can ba added to the reference list. The preset element are the target component, a rootType (enum scene or prefab), the addressable table it will be added and the keyname it would have.
The table name format is “[RootType][SceneName][ComponentType]”.
The Keyname is a concat of the scene name and all gameobject name to from the scene root to the component.
There are also 2 booleans : exists (true if the table/entry already exists in the addressables) and duplicate (true if the same table/entry pair is at least twice in the preset list).
You can remove line, or click on any component to rename it (to get another keyname) and regenerate the list.
Lastly the scan button, already explained before. The apply button that will populate the reference list with the preset list (and create missing tables and entries accordingly) and the clear button that just clear the preset list.
I am open to any feedback about that flow and hope unity will do something similar in the future.
As I played a bit with the API :
- I had to make different code according the context (editor/edit, editor/play, runtime) with some #IF UNITY_EDITOR and Application.IsPlaying. It should probably be on unity side. Providing single entry point for all context would be nicer.
- I did not rework the assets support a lot yet, but it seems assets and strings api are differents. As they actually seems both to handle strings as value they probably could become an unified api as well.
- I used UnityEditorInternal.ReorderableList and had a lot of trouble to make a custom inspector, actually extending the editor in a nightmare but I more or less succeed to have something “showable”. Hoewever I still have trouble to manage the LocalizedReference width in my reference list, any advice about that element ? Will it change ?
