开发者

Format date in JSP for unsupported Locale [duplicate]

开发者 https://www.devze.com 2023-02-13 08:49 出处:网络
This question already has answers here: How to use unsupported Locale in Java (2 answers) Closed 2 years ago.
This question already has answers here: How to use unsupported Locale in Java (2 answers) Closed 2 years ago.

I have a date and I want to output it in a JSP. Currently I use JSTL:

<fmt:formatDate pattern="dd MMMM yyyy" value="${date}"开发者_开发问答 />

Which is very neat as long as the user's language is one that is supported by the JRE. However, we have a requirement to provide this user interface in Welsh. If there a nice way to get the name of the month output in Welsh?


If using Java 6, APIs have been exposed to allow you to add localization support to locales that are not supported by the JRE itself. See the "Local sensitive services" section in the following link for a brief overview: http://java.sun.com/developer/technicalArticles/javase/i18n_enhance/

An alternative option is to build your own custom tag which uses custom resource bundles to display the month in the correct language.

0

精彩评论

暂无评论...
验证码 换一张
取 消