setMessagePack confusion

Hi all,

I’ve got a local messages.properties file that I have a few lengthy messages stored in for a screen, so they are currently in /src/com/company/myapp/web/screens/myscreen/messages.properties. I now need to reference these lengthy messages in another screen as well, so my plan was to either use MessageBundle.setMessagePack() in the new screen to a value representing the current location of the messages.properties file that I need, or move them to the main message pack so they can be used on both screens from a centralized location.

The problem I’m having is that I can’t figure out what String value I should use in the setMessagePack() method. I checked the documentation and searched the forum, but I didn’t find any reference to what type of value I should be using to change to a different message pack (‘path/to/file’ or ‘mainMsg://…’ or something else).

Can you please clarify this for me?

Thanks,
Adam

Hi,
You can the following methods and XML constructs to access messages from any message pack:
In Java:

String message2 = messages.getMessage("com.abc.sales.web.customer", "someMessage");

In screen descriptors:

caption="msg://com.abc.sales.entity/Customer.name"

These code examples can be found in docs:
https://doc.cuba-platform.com/manual-7.2/messages.html
https://doc.cuba-platform.com/manual-7.2/entity_localization.html

Using messageBundle.setMessagesPack wasn’t intended by platform developers.

Hi Alexander,

Thank you for the clarification and information. I have deleted my alternate solution as not to confuse anyone further. Your solution is more useful, as the message pack location doesn’t need to be changed back after retrieving the desired message.

Thanks,
Adam