OFBiz国际化设置

文件如何定义/config/XXXUILabels.xml
<?xml version="1.0" encoding="UTF-8"?>
<resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <property key="AjaxExamples">
        <value xml:lang="en">Ajax Examples</value>
        <value xml:lang="fr">Exemples Ajax</value>
        <value xml:lang="it">Esempi Ajax</value>
        <value xml:lang="zh">应用程序</value>
    </property>
    <property key="AjaxIntro">
        <value xml:lang="en">To use this Ajax demonstration, you must have JavaScript enabled on your browser.</value>
        <value xml:lang="fr">Pour utiliser cette démonstration Ajax, vous devez avoir activé Javascript </value>
        <value xml:lang="it">Per usare questa dimostrazione Ajax, tu devi avere JavaScript abilitato sul tuo browser.</value>
    </property>
</resource>

如何加载:
ofbiz-component.xml
<classpath type="dir" location="config"/>

导入 定义统一名字
CommonScreen.xml
        <screen name="main-decorator">
        <section>
            <actions>
                <!-- base/top/specific map first, then more common map added for shared labels -->
                <property-map resource="XXXUILabels" map-name="uiLabelMap" global="true"/>
            </actions>
            <widgets>
                <include-screen name="GlobalDecorator" location="component://common/widget/CommonScreens.xml"/>
            </widgets>
        </section>
    </screen>

实际应用 比如Screen.xml

            <screen name="Test">
        <section>
            <actions>
                <set field="headerItem" value="***"/>
            </actions>
            <widgets>
                <decorator-screen name="main-decorator" location="component://XXX/widget/CommonScreen.xml">
                    <decorator-section name="body">
                        <section>
                            <condition>
                                <if-has-permission permission="EXAMPLE" action="_VIEW"/>
                            </condition>
                            <widgets>
                                <container style="h1"><label> ${uiLabelMap.AjaxExamples}</label></container>
                               
                                。。。。。
                               
                            <fail-widgets>
                                <label style="h3">${uiLabelMap.ExampleViewPermissionError}</label>
                            </fail-widgets>
                        </section>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>

最后想知道的是如何  让前台显示
  <value xml:lang="en">Ajax Examples</value>
  <value xml:lang="fr">Exemples Ajax</value>
  <value xml:lang="it">Esempi Ajax</value>
  <value xml:lang="zh">应用程序</value>
是其中的哪一种值得呢

经查找  OFBiz启动时候 一开始回去load  start.properties  
此文件中配置有
ofbiz.locale.default=zh  或者 ofbiz.locale.default=en
但  经过比对 发现  此处设置 根本无效

非常期待  得到解决


另外有一种解释
参考 http://hi.baidu.com/lcjbest/item/b066565f0567ab17aaf6d799
具体某个模块 项目加载的时候  配置初始化参数
ofbiz-component.xml

<webapp name="ecommerce"

        title="eCommerce"

        server="default-server"

        location="webapp/ecommerce"

        mount-point="/ecommerce"

        app-bar-display="false">

        <init-param name="Locale" value="zh"/>

<init-param name="Currency" value="CNY"/>

</webapp>

猜你喜欢

转载自zgzlwm.iteye.com/blog/1903839