掲示板

Localized layout titles/names

8年前 に Morad Ahmad によって更新されました。

Localized layout titles/names

Junior Member 投稿: 71 参加年月日: 10/06/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.