FeinesFabi
FeinesFabi

Reputation: 1207

Liferay - Get default language (locale) for a site

I need to programmatically get the default locale for a site. So I:

In my code I've tried to do the following:

CompanyThreadLocal.setCompanyId(portletDataContext.getCompanyId());
final Locale locale = LocaleUtil.getDefault();

But I get "en_us" for both sites, which is the portal default locale.

I need this in my export/import functions of my PortletDataHandler implementation. Otherwise I will allways export my data with the wrong default language from staging to live.

I'm running Liferay 6.1.20 EE.

Thanks in advance, Fabi

Upvotes: 3

Views: 4965

Answers (1)

Reigo
Reigo

Reputation: 285

In Liferay 6.2 you can just do:

Locale defaultLocale = PortalUtil.getSiteDefaultLocale(groupId);

Upvotes: 1

Related Questions