Hello, I’m trying realtime data bindings and localization features.
I know how to bind to specific localization key through LocalizedString binding. It works great, but.
Let’s go further. I got the view that has its data source. And I want to assign LocalizedString TableEntryReference (localized key) from that defined data source. I know how to change it from the code or fill that data source with an already localized string (this won’t work if we change the language).
The best would be to have LocalizedString binding the key can be bound from the data source.
I’m not sure I understand. Can you provide more details, maybe an example of what you are trying to do?
Sure,
I want a scriptable object (or other data source) containing localised item names.
Like
SO1
SO2
Those are localised strings in the Unity Localisation package and are translated to
item1Name: Leather Armor
item2Name: Chain Armor
So in Unity Toolkit, I want to have a binding that will take SO1.name value and localize it to Leather Armor
Ok. For this to work you would need to define a converter so it knows how to convert a LocalizedString. The simplest thing to do would be to add another property which is a string that does LocalizedString.GetLocalizedString on the property, then bind against that property.
Does that will detect language change?
No, but you could implement the property changed interface and call that when the locale changed.
Is there any example using that interface?
Thanks,
I’m already using it in some places when I want to auto-update my UI when something is changed. However my concern is that when the user changes the language, I need to update all my properties to get it to work.