Dear Gurus,
I tried to use groovy file to customize the back-end language setting with the
following steps:
1. Change the "GlobalDecorator" Screen of the file
framework\common\widget\commonscreens.xml by adding the following highlighted
underlined codes:
<!-- Global decorator for General Screens/Pages -->
<screen name="GlobalDecorator">
<section>
<widgets>
<include-screen name="GlobalActions" />
<section>
<actions>
<set field="layoutSettings.commonHeaderImageLinkUrl"
from-field="layoutSettings.commonHeaderImageLinkUrl" default-value="main"
global="true" />
<set field="iconsLocation"
from-field="layoutSettings.VT_ICONS_LOC[0]"
default-value="/images/icons/famfamfam" global="true" />
<set field="headerTemplateLocation"
from-field="layoutSettings.VT_HDR_TMPLT_LOC[0]" />
<set field="footerTemplateLocation"
from-field="layoutSettings.VT_FTR_TMPLT_LOC[0]" />
<set field="appbarTemplateLocation"
from-field="layoutSettings.VT_NAV_TMPLT_LOC[0]" />
<set field="appbarOpenTemplateLocation"
from-field="layoutSettings.VT_NAV_OPEN_TMPLT[0]" />
<set field="appbarCloseTemplateLocation"
from-field="layoutSettings.VT_NAV_CLOSE_TMPLT[0]" />
<set field="messagesTemplateLocation"
from-field="layoutSettings.VT_MSG_TMPLT_LOC[0]" />
<set field="layoutSettings.suppressTab"
value="ofbizsetup"/><!-- diseable ofbiz setup by default -->
<script
location="component://common/groovyScripts/SetLocale.groovy"/>
</actions>
<widgets />
</section>
......
2. Then I added the SetLocale.groovy file in the above location as follows:
import org.apache.ofbiz.base.util.UtilHttp
setLocale(request,"zh_CN")
3. After a reboot, I got the following error message and could not figure
out why.
(Error running script at location
[component://common/groovyScripts/SetLocale.groovy]:
groovy.lang.MissingMethodException: No signature of method:
SetLocale.setLocale() is applicable for argument types:
(org.apache.catalina.connector.RequestFacade, java.lang.String) values:
[org.apache.catalina.connector.RequestFacade@2a5d73ab, zh_CN])))
Pls help me! Thanks!
Best Regards
Schumann