Reputation: 947
I have a language dropdown in my web application which has English and Arabic. I have these values in my application.properties
file. Below is how I have the configuration for the language dropdown.
languages=[ {"name": "English", "code": "EN"}, {"name": "العربية", "code": "AR"}]
Now when I access this configuration and populate the dropdown, String in Arabic is showing weird characters. I am also using Thymeleaf as my frontend rendering framework. How to get the Arabic string using this configuration or is there any other better alternative.
Thanks
Upvotes: 2
Views: 938
Reputation: 947
What I actually did is, in my i18n folder, I am using a property file to hold arabic strings. There I used a config as AR=العربية
. Then in my html file, to display the arabic string, i did <span th:text="#{__${language.code}__}">العربية</span>
So, what is happening now is, I am reading the arabic string from the i18n arabic messages property file to display arabic string.
Upvotes: 1