Sorry, I forgot to edit one thing in the answer above. You must include
the locale in the call to I18nUtil.getMessage:
18nUtil.getMessage("jsp.home.com.name." + c.getName(), sessionLocale)
Best regards,
Paul
On Tuesday, May 24, 2022 at 4:55:25 PM UTC+2 [email protected] wrote:
> I found the answer.
>
> In the jsp, enter the I18nUtil class, the Locale class, and the UIUtil
> class:
>
> <%@ page import="org.dspace.core.I18nUtil" %>
> <%@ page import="java.util.Locale"%>
> <%@ page import="org.dspace.app.webui.util.UIUtil" %>
>
> Inside the showCommunity method, capture the current locale from the
> request:
>
> Locale sessionLocale = UIUtil.getSessionLocale(request);
>
> Then, down where you call c.getName(), you change it to:
>
> I18nUtil.getMessage("jsp.home.com.name." + c.getName())
>
> or whatever name you have given your entry in Message.properties.
>
> And do not forget to do the same with the collections.
>
> Very simple solution!
>
> Best regards,
> Paul
>
> On Tuesday, May 24, 2022 at 3:38:22 PM UTC+2 [email protected] wrote:
>
>> I am interested in using the Messages.properties and
>> Messages_de.properties entries with community-list.jsp. Right now, the jsp
>> calls the showCommunity method in order to display the list of communites
>> and collections. I want the names to appear in the user's selected
>> language, and I have everything entered in Message.properties and
>> Message_de.properties to do this. But how do I use the <fmt:message> tag
>> inside this method? The names are all raw:
>>
>> out.println( "<div class=\"media-body\"><h4 class=\"media-heading\"><a
>> href=\"" + request.getContextPath() + "/handle/"
>> + c.getHandle() + "\">" + c.getName() + "</a>");
>>
>> Thanks for any suggestions.
>>
>> -Paul
>>
>
--
All messages to this mailing list should adhere to the Code of Conduct:
https://www.lyrasis.org/about/Pages/Code-of-Conduct.aspx
---
You received this message because you are subscribed to the Google Groups
"DSpace Technical Support" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/dspace-tech/0d506c6f-3e39-4954-b8b2-dcca8e35107cn%40googlegroups.com.