我已经在items.xml中创建了一个自定义类型。如何本地化项目类型?对于要本地化的项类型,我应该在哪里使用本地化关键字?
<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>发布于 2021-06-12 13:14:46
你接受的答案是错误的。
你不应该做type="localized:Service"。这样做可以让您为每种语言设置不同的服务值。
如果您想要为服务类型添加不同的标签/本地化,那么what you did in your other question是正确的。
对于英语本地化/翻译,请在trainingcore_locales_en.properties中定义本地化
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。
参考资料:
发布于 2021-09-15 10:31:03
@geffchang's answer是正确的。@Parvesh是错的。仅仅通过添加localized:就不可能拥有自动本地化的服务。
为此,您需要创建新的映射类型:
<maptype code="localized:Service"
argumenttype="Language"
returntype="Service"
autocreate="true"
generate="false"/>发布于 2021-06-12 09:02:56
您的意思是要将此服务添加为另一项类型中的本地化属性吗?
用这样的方法就能做到。
` <attribute qualifier="service" type="localized:Service">
<persistence type="property" />
</attribute>`https://stackoverflow.com/questions/67946399
复制相似问题