首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何本地化在Hybris中的培训核心-items.xml中创建的自定义类型?

如何本地化在Hybris中的培训核心-items.xml中创建的自定义类型?
EN

Stack Overflow用户
提问于 2021-06-12 06:56:02
回答 3查看 1.6K关注 0票数 1

我已经在items.xml中创建了一个自定义类型。如何本地化项目类型?对于要本地化的项类型,我应该在哪里使用本地化关键字?

代码语言:javascript
复制
    <itemtype code="Service" autocreate="true" generate="true">
           <deployment typecode="23456" table="Service"/>
            <attributes>
                <attribute qualifier="code" type="java.lang.String" autocreate="true" generate="true">
                    <persistence type="property"/>
                    <description>Service Code</description>
                    <modifiers unique="true" read="true" write="true"/>
                </attribute>
                <attribute qualifier="serviceType" type="ServiceType" autocreate="true" generate="true">
                    <persistence type="property"/>
                    <description>Service Type</description>
                    <modifiers read="true" write="true"/>
                </attribute>
                <attribute qualifier="years" type="java.lang.Integer" autocreate="true" generate="true">
                    <persistence type="property"/>
                    <description>Service Years</description>
                    <modifiers read="true" write="true"/>
                </attribute>
    </itemtype>
EN

回答 3

Stack Overflow用户

回答已采纳

发布于 2021-06-12 13:14:46

你接受的答案是错误的。

你不应该做type="localized:Service"。这样做可以让您为每种语言设置不同的服务值。

如果您想要为服务类型添加不同的标签/本地化,那么what you did in your other question是正确的。

对于英语本地化/翻译,请在trainingcore_locales_en.properties中定义本地化

代码语言:javascript
复制
type.Service.name=Service
type.Service.code.name=code
type.Service.serviceType.name=serviceType
type.Service.years.name=years

type.ServiceType.name=ServiceType
type.ServiceType.Basic.name=Basic
type.ServiceType.BasicOnsite.name=BasicOnsite
type.ServiceType.Advanced.name=Advanced

对于德语翻译,将翻译设置为trainingcore_locales_de.properties

参考资料:

https://help.sap.com/viewer/d0224eca81e249cb821f2cdf45a82ace/2011/en-US/8c05dbbc86691014a3fb88b6238b64b6.html

  • 本地化
票数 1
EN

Stack Overflow用户

发布于 2021-09-15 10:31:03

@geffchang's answer是正确的。@Parvesh是错的。仅仅通过添加localized:就不可能拥有自动本地化的服务。

为此,您需要创建新的映射类型:

代码语言:javascript
复制
<maptype code="localized:Service"
     argumenttype="Language"
     returntype="Service"
     autocreate="true"
     generate="false"/>
票数 0
EN

Stack Overflow用户

发布于 2021-06-12 09:02:56

您的意思是要将此服务添加为另一项类型中的本地化属性吗?

用这样的方法就能做到。

代码语言:javascript
复制
`   <attribute qualifier="service" type="localized:Service">
                    <persistence type="property" />
                </attribute>`
票数 -2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/67946399

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档