Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Scarletake Bwi
how to get user's default language
February 19, 2013 1:58 AM
Answer

Scarletake Bwi

Rank: Junior Member

Posts: 81

Join Date: December 19, 2010

Recent Posts

hi

I'd like to create a portlet, and it will query all portal user, identify who's birthday is today, and send a e-card.
maybe, i can use UserLocalServiceUtil and MailServiceUtil to do what i want.

but, i just cannot get user's default language.
I have thought about use userId to get company (companyId) with relation, and then, i can get address and country.
but, one user, can join more then one company, and a company can stand on more then one country...

any suggestion?

thank you.
Juhi Kumari
RE: how to get user's default language
February 19, 2013 2:19 AM
Answer

Juhi Kumari

Rank: Expert

Posts: 347

Join Date: December 12, 2011

Recent Posts

Hi,
You can get user's default language by using
1user.getLanguageId();


Regards
Juhi
Jaynil A Bagdai
RE: how to get user's default language
February 23, 2013 5:54 AM
Answer

Jaynil A Bagdai

Rank: Regular Member

Posts: 120

Join Date: March 3, 2012

Recent Posts

Hi Scarletake,

1UserLocalServiceUtil.getUser(userId).getLocale(); or UserLocalServiceUtil.getUser(userId).getLanguageId();
as per your requirement.
Hitoshi Ozawa
RE: how to get user's default language
February 23, 2013 6:48 PM
Answer

Hitoshi Ozawa

Rank: Liferay Legend

Posts: 7954

Join Date: March 23, 2010

Recent Posts

You'll have to do the following to get the language from locale.

UserLocalServiceUtil.getUser(userId).getLocale().getLanguage()