0

I am creating a web application using Thymeleaf with Spring. For that, I am following following document:

http://www.thymeleaf.org/doc/articles/thvsjsp.html

In this document, following code is being discussed:

https://github.com/thymeleaf/thymeleafexamples-thvsjsp

I am trying to get internationalization with Hindi (Indian language), for that I forked the repo given above and added one property file related to hi_IN (hindi-India), please see below code base on github:

https://github.com/prashantbhardwaj/thymeleafexamples-thvsjsp/tree/locale_change

When I tried, instead of getting hindi in browser, I got questions marks. I tried changing encoding of this property file from ISO-8859-1 to UTF-8, but no benefit. Values, I am expecting for given properties are as follows:

subscription.email=ईमेल
subscription.type=प्रकार
subscription.submit=प्रेषित करें!
subscriptionType.ALL_EMAILS=सभी ईमेल
subscriptionType.DAILY_DIGEST=प्रतिदिन का पत्र

In Messages_hi_IN.properties file, I changed all the values from hindi (which was not hindi but escaped version of hindi) to english so you can copy and paste values which are provided by me.

Could you please help get me desired results? Locale for Hindi is hi_IN.

  • In your config, do you use something like this? `@Bean public ReloadableResourceBundleMessageSource messageSource() { ReloadableResourceBundleMessageSource source = new ReloadableResourceBundleMessageSource(); source.setBasename("classpath:messages"); source.setDefaultEncoding("UTF-8"); return source; }` – riddle_me_this May 07 '17 at 00:36
  • If so, try using lower case for the filename – riddle_me_this May 07 '17 at 00:36
  • Also make sure your file is in your `resources` folder. The answer to this post may also help you: http://stackoverflow.com/questions/30617950/fmtmessage-prints-key-with-question-marks-like-so-login-label-username – riddle_me_this May 07 '17 at 00:39
  • Dear bphilipnyc, property file is getting picked, because when I change any text in the property file for hindi language, number of question marked get changed. It proves that file is getting picked. Even, If I delete the file, I get key names, again It proves that file is getting picked. source.setDefaultEncoding("UTF-8") is already there. It doesn't make any difference. Could you please checkout my project and try at your end. It doesn't make any db connection .. – Prashant Bhardwaj May 10 '17 at 06:27

0 Answers0