Liferay custom portlet permission label missing

回眸只為那壹抹淺笑 提交于 2019-12-11 11:16:24

问题


I've followed the instructions from this tutorial to introduce a new portlet level permission for my custom portlet.

In the resource-action-mapping XML there is a new action-key called PARTNER_ADMIN_CONTRACTING, and I've added the following line to the Language.properties file:

action.PARTNER_ADMIN_CONTRACTING=Admin contracting

On the Define permissions tab, it still shows the label key, not the value:

What's missing?


回答1:


You have to add the action.PARTNER_ADMIN_CONTRACTING=Admin contracting language key to the portal resource bundle, because the Control Panel does not look for the translation in your portlet. You can use the language hook feature do to this:

  1. Create a liferay-hook.xml in your docroot/WEB-INF directory:

    <?xml version="1.0"?>
    <!DOCTYPE hook PUBLIC "-//Liferay//DTD Hook 6.2.0//EN" "http://www.liferay.com/dtd/liferay-hook_6_2_0.dtd">
    
    <hook>
       <language-properties>content-portal/Language.properties</language-properties>
    </hook>
    
  2. Create docroot/WEB-INF/src/content-portal/Language.properties:

    action.PARTNER_ADMIN_CONTRACTING=Admin contracting   
    

This should work!



来源:https://stackoverflow.com/questions/28107289/liferay-custom-portlet-permission-label-missing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!