掲示板

Embedding Language Portlet into custom theme

8年前 に Jatinderpal Singh によって更新されました。

Embedding Language Portlet into custom theme

Junior Member 投稿: 49 参加年月日: 15/08/14 最新の投稿
I am trying to embed Language Portlet into my custom theme. I am using the following code : -
#set ($VOID = $velocityPortletPreferences.setValue('display-style', '1'))
#set ($VOID = $velocityPortletPreferences.setValue('portlet-setup-show-borders', 'false'))
#set ($instanceId = 'E8j2')
#set ($myPortletId = "82_INSTANCE_${instanceId}")$theme.runtime($myPortletId, '', $velocityPortletPreferences.toString())
#set ($VOID = $velocityPortletPreferences.reset())


It embeds well. But it does not work. It does not convert the language of the page. It just reloads the page.
How it can be embedded into theme?
8年前 に Jatinderpal Singh によって更新されました。

RE: Embedding Language Portlet into custom theme

Junior Member 投稿: 49 参加年月日: 15/08/14 最新の投稿
Is there any other solution ? Kindly suggest. I urgently need this
thumbnail
8年前 に Bijan Vakili によって更新されました。

RE: Embedding Language Portlet into custom theme

Expert 投稿: 375 参加年月日: 09/03/10 最新の投稿
Line 4 in code's actually two lines. In any case, here is what I think:
That portlet is just not instanceable:

        <portlet>
                <portlet-name>82</portlet-name>
                <icon>/html/icons/language.png</icon>
                <struts-path>language</struts-path>
                <configuration-action-class>com.liferay.portal.kernel.portlet.DefaultConfigurationAction</configuration-action-class>
                <preferences-owned-by-group>true</preferences-owned-by-group>
                <use-default-template>false</use-default-template>
                <layout-cacheable>true</layout-cacheable>
                <private-request-attributes>false</private-request-attributes>
                <private-session-attributes>false</private-session-attributes>
                <render-weight>50</render-weight>
                <css-class-wrapper>portlet-language</css-class-wrapper>
                <add-default-resource>true</add-default-resource>
        </portlet>


https://github.com/liferay/liferay-portal/blob/6.2.x/portal-web/docroot/WEB-INF/liferay-portlet.xml#L753
Have you tried configuring it for site?
8年前 に Jatinderpal Singh によって更新されました。

RE: Embedding Language Portlet into custom theme

Junior Member 投稿: 49 参加年月日: 15/08/14 最新の投稿
Thank you dear for pointing out about instancable of the portlet.
I am just new to all these things.
I googled about it and tried this method : -
https://www.liferay.com/web/raymond.auge/blog/-/blogs/embedding-portlets-in-themes-on-liferay#ofge_message_64576913

It does the same thing. It embeds well the portlet. On change of the language, it refreshes the page and restore the selected value. But does not translate the page.
Then I have to reload the page and then it translate the page.
Can we improve it ?
8年前 に Jatinderpal Singh によって更新されました。

RE: Embedding Language Portlet into custom theme (回答)

Junior Member 投稿: 49 参加年月日: 15/08/14 最新の投稿
Okay.
I am able to find a working way to add language portlet to theme by following method : -
$theme.langauge()


But now the next step is to find out how to configure this portlet's from ICONS to SELECT BOX.
Is there any way to do so ?
thumbnail
8年前 に Bijan Vakili によって更新されました。

RE: Embedding Language Portlet into custom theme

Expert 投稿: 375 参加年月日: 09/03/10 最新の投稿
You can create JSP hook for that; to override or extend JSP; e.g. to hide icons and add drop down.

There are lots of resources on the hooks; see the Liferay dev guide or just search this:
https://www.google.com/search?client=ubuntu&channel=fs&q=liferay+jsp+hook&ie=utf-8&oe=utf-8
8年前 に Jatinderpal Singh によって更新されました。

RE: Embedding Language Portlet into custom theme

Junior Member 投稿: 49 参加年月日: 15/08/14 最新の投稿
Bijan Thank you for your help.

I have no idea how to hook Liferay Function. I was able to hook only JSP pages.
In my template I am using Liferay Function to embed language portlet into theme.

But I have solved my problem. I changed the images of flags with images containing name of the language.

If is there anything I can do, kindly guide me.
thumbnail
8年前 に Ramanjeneyulu Bodepudi によって更新されました。

RE: Embedding Language Portlet into custom theme

Junior Member 投稿: 42 参加年月日: 12/02/24 最新の投稿
Need to use theme.runtime with corresponding portlet id for including portlet in theme,