Message Boards
how to use Internationalization in serviceImpl(service builder)
how to use Internationalization in serviceImpl(service builder)
Expert Posts: 326 Join Date: 12/20/10 Recent Postshi
i'd like to know, is there passable to use LanguageUtil in serviceImpl class?
my request is send mail to some use and trigger by method of thread and serviceImpl class.
i know how to use in portlet or jsp
LanguageUtil.get(request, <key>, <default value>)
but in my BaseMessageListener or other thead, i do have request(ActoinRequest or RenderRequest)
how can i use LanguageUtil? or is there anyother way to use internationalization?
thank you in advance
in current, i use liferay ce 7.4.3.4
i put constent folder onder src/main/java, and use
ResourceBundle rb = ResourceBundle.getBundle("constent.Language", currentLocale);
System.out.println(rb.getString(<my key>));
RE: how to use Internationalization in serviceImpl(service builder)
Liferay Legend Posts: 6403 Join Date: 9/23/08 Recent PostsLanguageUtil also has methods that take a Locale instead of a request
RE: RE: how to use Internationalization in serviceImpl(service builder)
Expert Posts: 326 Join Date: 12/20/10 Recent Postshi Olaf
thank you.
but my question is, i cannot get the properties when it in src/main/resource.
in portlet, i can config in annotation @Component, but in other independent object, i don't know how to do.
RE: how to use Internationalization in serviceImpl(service builder)
Liferay Master Posts: 591 Join Date: 8/8/14 Recent PostsHi,
You can refer different module Language resources by adding "-liferay-aggregate-resource-bundles:module name to refer resourcebundle" in your bnd file. Please refer below: