留言板

Localized layout titles/names

Morad Ahmad,修改在8 年前。

Localized layout titles/names

Junior Member 帖子: 71 加入日期: 10-6-16 最近的帖子
During initlization of my portal I used a hook to create portal layouts. At this phase I only add layouts in 2 Languages EN and DE. After start I want to add additional languages (ES).

For Layot titles I used to set a "languageMap"

titleMap = LocalizationUtil.getLocalizationMap("content.Language", PortangoSitesHookUtils.class.getClassLoader(), key, false);
...
Layout layout = LayoutLocalServiceUtil.addLayout(group.getCreatorUserId(), group.getGroupId(), privateLayout, parentLayoutId, nameMap,
titleMap, descriptionMap, keywordsMap, robotsMap, LayoutConstants.TYPE_PORTLET, typeSettings, hidden, friendlyURLMap,
serviceContext);

I must translate all layout titles to other languages. The only way I know is doing that manually for each layout in the admin console. Does anybody know how to use a "key" as layout title instead of a translated text? Or a simple way to put the new translations for existing layouts?

Does it make since e.g to write a job to reload translations periodically for example:

layout = getLayout("siteX/news");
titleMap = LocalizationUtil.getLocalizationMap("content.Language", PortangoSitesHookUtils.class.getClassLoader(), "menu.news", false);
layout.setTitleMap(titleMap);

Thank you,
Morad.