0
votes

I follow a guide to add the Thai language to liferay. First step: add below servlet mapping to web.xml file

 <servlet-mapping>
     <servlet-name>I18n servlet</servlet-name>
     <url-pattern>/th/*</url-pattern>
 </servlet-mapping>

Second Step: add url pattern

 <url-pattern>/th/c/portal/protected</url-pattern>

Third step: add "th" to portal-ext.properties file

 locales=th

After above operations, I can see the Thai in the available language like this But when I press the left arrow, moved it to current language and press the save button. I got a "Please enter a valid locale." message. Is there anyone can help me to figure the problem? Thank you so much!!

2
What version of Liferay is your question for? OSGi-based or not?Nicolas Raoul

2 Answers

0
votes

look at this wiki https://web.liferay.com/fr/web/salman.khan/blog/-/blogs/add-a-new-language-to-liferay-detailed-step-by-step-

you forgot Step3: Finally you will need a hook to push your own "language_.properties" file into Liferay. In this case it is "language_th.properties".

Follow the steps given on wiki.

0
votes

I don't see anywhere in the details you provided that you created a language hook, which I believe you will need: https://dev.liferay.com/develop/tutorials/-/knowledge_base/6-2/overriding-language-properties-using-a-hook

That link assumes you're using Liferay 6.2, correct me if I'm mistaken.

In your hook, you need to provide a language properties file for the locale you added to portal-ext.properties (e.g., Language_th.properties) with the translated keys in order to make this work (I'm fairly certain of this).