我不知道每个站点的默认语言配置设置(如果您的意思是社区/组织...)存在。
对于整个门户,您在
下有“默认语言”选项
Control panel -> Portal settings -> Display settings
但是如果你没有你的语言,或者你想删除/添加一些语言,你可以在portal-ext.properties 中配置它。例如
locales=hr_HR,en_US
编辑(有关评论中提到的错误的更多信息)
如果你看看 com.liferay.portal.service.impl.CompanyLocalServiceImpl
public void updatePreferences(long companyId, UnicodeProperties properties)
throws PortalException, SystemException {
PortletPreferences preferences = PrefsPropsUtil.getPreferences(
companyId);
try {
String newLocales = properties.getProperty(PropsKeys.LOCALES);
if (newLocales != null) {
String oldLocales = preferences.getValue(
PropsKeys.LOCALES, StringPool.BLANK);
if (!Validator.equals(oldLocales, newLocales)) {
validateLocales(newLocales);
LanguageUtil.resetAvailableLocales(companyId);
}
}
...
}
protected void validateLocales(String locales) throws PortalException {
String[] localesArray = StringUtil.split(locales, StringPool.COMMA);
for (String locale : localesArray) {
if (!ArrayUtil.contains(PropsValues.LOCALES, locale)) {
throw new LocaleException();
}
}
}
你会看到“newLocales”被验证了
if (!ArrayUtil.contains(PropsValues.LOCALES, locale)) {
throw new LocaleException();
}
因此,如果您在 Portal 设置的显示页面中添加新的区域设置键,该页面不在 portal-ext.properties 或 portal.properties 中,您将获得LocaleException。
注意 oldLocales 是从首选项(数据库)String oldLocales = preferences.getValue(PropsKeys.LOCALES, StringPool.BLANK); 中读取的
并针对portal.properties/portal-ext.properties if (!ArrayUtil.contains(PropsValues.LOCALES, locale)) { ...进行验证
PropsValues.LOCALES => public static String[] LOCALES = PropsUtil.getArray(PropsKeys.LOCALES);
如评论中所述,当(且仅当)您添加不在 portal.properties 中的新语言环境(在 GUI 中)时,才会发生这种行为
locales=ar_SA,eu_ES,bg_BG,ca_AD,ca_ES,zh_CN,zh_TW,hr_HR,cs_CZ,da_DK,nl_NL,nl_BE,en_US,en_GB,et_EE,fi_FI,fr_FR,gl_ES,de_DE,el_GR,iw_IL,hi_IN,hu_HU,in_ID,it_IT,ja_JP,ko_KR,lo_LA,nb_NO,fa_IR,pl_PL,pt_BR,pt_PT,ro_RO,ru_RU,sr_RS,sr_RS_latin,sl_SI,sk_SK,es_ES,sv_SE,tr_TR,uk_UA,vi_VN
或者如果您在 portal-ext.properties 中修改了 locales,而不是在 portal-ext.properties 中修改。
例如,如果您在 portal-ext.properties 中有
locales=en_GB
您将无法从 GUI 添加任何其他语言环境,除非您首先将新语言环境添加到 portal-ext.properties,然后转到门户设置的显示页面并再次添加。