Enum Localization

Hello, I got a problem with the localization of an enum value. The line in the messages.properties file is:

InvoiceState.PAID=Paid

… but in the UI the enum value is rendered like this:
image

I use CUBA 7.2.11 with kotlin.
Any idea why?

Hi,
Can you show your InvoiceState enum source code?

@AlexBudarov Hi Alex, thanks for asking. Indeed I implemented a method in this enum. This apparently changes how the enum is compiled. The $ in the output was the hint that this enum is now an inner class. After removing the method, the translation works.

So I guess the solution is to not put methods in enums in CUBA. :slight_smile:

Hi,

putting methods in enums should not be a problem. I have done that several times in various projects with CUBA.

Cheers
Mario

@mario Indeed, this is an issue with kotlin + CUBA. Here is a minimal project that shows the issue:
enumtranslation.zip (95.4 KB)

It shows the difference between java entity with java enum vs kotlin entity with kotlin enum.

@AlexBudarov fyi

I’ve created a bug ticket:

1 Like