Is there any way to have localised values for entities?
what do you mean by values of entities? Do you mean translation of attributes (e.g. Customer.orders = Orders / Bestellungen)?
Generally, the docs should give you a good starting point: https://doc.cuba-platform.com/manual-6.2/localization.html
Probably this is about localizing values, not captions. Do I understand right that you want to store multiple values for a field and display one depending on the current user locale?
Hi Konstantin. That’s precisely it. I understand that the display part can be a bit domain specific, but having a some sort of component for inserting localised data for some of the attributes would be really cool.
We’ve implemented such kind of text field in one of our products in the following way: the entity attribute stores a JSON that contains values in all required locales, and the text field chooses one depending on the current locale. The obvious drawback is that you cannot search by this attribute (at least by strict equality) using standard mechanisms.
We have the following preliminary thoughts of how to solve the problem in the platform:
- add a special @Localizable annotation for attributes containing localizable values;
- the annotation can also specify how to store the values - in a JSON or in separate attributes of the entity;
- standard text fields will recognize the annotation and work with the value for the current locale;
- the mechanism of getting the instance name (based on @NamePattern) should also recognize @Localizable.
What do you think? In what part of your system do you need localizable attributes?
we would like to know what the status is regarding localizable values in CUBA Platform. It’s something we really need in our project and we would prefer a built-in solution for it.
You can track the progress using the linked issue. The roadmap for release 6.5 is already closed, so we are going to deal with this problem later this year.
See the following issue in our bug tracker:
The linked ticket has priority major but seems this hasn’t been touched in over a year.
This is a very important requirement for us.
Any tips/guides or update on the roadmap?
Hi there! Are there any updates on the status of the feature?