How to customize labels in name layout?

When changing the name template as detailed here Customizing Name Layouts - Documentation - OpenMRS Wiki , how do i change the labels of say ‘Given’ and Family Name as they appear here

They are defined in openmrs-core:

https://github.com/openmrs/openmrs-core/blob/master/webapp/src/main/webapp/WEB-INF/messages.properties#L1818-L1828

You would have to modify the file or use https://wiki.openmrs.org/display/docs/Custom+Messages+Module

2 Likes

Since it is your custom name template, i would just you put the exact label you want in the template instead of the code, if you want the label to change based on languaga, then you need to change the label in the messages file rafal pointed out, it is located in your tomcat folder under /webapps/openmrs/WEB-INF but the problem is that if you change war file(upgrade) then you will lose the translations, basically you would have to do this every time you upgrade. Alternatively you could use the custom messages module since it stores the labels in the DB

1 Like

Is there a way to limit the names i want to show - I just want to show the First and Last name - and no middle name

Thanks

Is there a way to limit the names i want to show - I just want to show the First and Last name - and no middle name

Thanks

This worked really good @raff

I tried installing custom messages module and I was able to interact with and was able to customize some labels. The only problem is that it is preventing me from loading the refrence application. Has anyone tried this module on reference application? This the error am getting

org.springframework.context.NoSuchMessageException: No message found under code ‘ui.i18n.Location.name.ea29699c-943f-4db4-9551-690c40c74a0d’ for locale ‘en_US’. at org.springframework.context.support.AbstractMessageSource.getMessage(AbstractMessageSource.java:155) at org.openmrs.ui.framework.FormatterImpl.getLocalization(FormatterImpl.java:149)

@wyclif @burke @mseaton

@ningosi, I’m not sure I’ve tried. One thing to investigate is whether or not the uiframework and custommessage modules are compatible based on how they are using and configuring the message sources. The custommessage module works by updating the active message source and setting the previously active message source to be it’s parent. The uiframework module works by wiring in the active message source in the constructor of the FormtatterImpl class. It’s possible that these are not compatible with each other and need to be tweaked. Otherwise, I don’t have much insight into why this doesn’t work.

Mike