开发者

How to create/read a node bilingualy

开发者 https://www.devze.com 2023-04-03 06:22 出处:网络
I need to create nodes with bilingual properties, and use all of these nodes as (List constraints) where node property will be label and another property will be value.

I need to create nodes with bilingual properties, and use all of these nodes as (List constraints) where node property will be label and another property will be value.

So, is this doable ? & how ?

I see sys:localized, and its mean

Localization: If you add this aspect to a node, then the server will assume that all non-multilingual properties apply to this locale. can this help me !开发者_开发技巧

Thanks Mohammed Amr Senior System Developer


In order to handle Multi Lingual documents from your code you are supposed to use the MultilingualContentService to:

  • add a translation

  • retrieve the available translations

  • etc.

Multilingual documents have the cm:mlDocument aspect applied. This enables them to be listed as children of the special cm:mlContainer that's created under /cm:multilingualRoot to track translations of a single document. The cm:mlContainer is defined as follows:

  <type name="cm:mlContainer">
     <title>Multilingual Container</title>
     <parent>sys:container</parent>
     <associations>
        <child-association name="cm:mlChild">
           <source>
              <mandatory>false</mandatory>
              <many>false</many>
           </source>
           <target>
              <class>cm:mlDocument</class>
              <mandatory>true</mandatory>
              <many>true</many>
           </target>
        </child-association>
     </associations>
     <mandatory-aspects>
        <aspect>cm:versionable</aspect>
        <aspect>cm:author</aspect>
        <aspect>sys:localized</aspect>
     </mandatory-aspects>
  </type>


There are different kinds of localization options in Alfresco:

  • The MultilingualContentService (with the cm:mlDocument aspect) allows you to store translated content on a single node. You can use this if you have a document that is translated into multiple languages. There is no support for this in Share but you can use it via the Alfresco Explorer or the API.

  • There are also multilingual text properties. You can use the datatype d:mlText in your content model and to store property values (strings only) based on the user language. The build in properties cm:title and cm:description are of type d:mlText. The usage in Share is a bit tricky though - Alfresco uses the browser language to automatically choose the locale, so users with different browser languages will see different values.

As far as I understand your question, I think what you need are the ml:properties. The Share UI only supports them indirectly, maybe that's ok for you. As for the the List constraints I have not seen any multi language support there, so you probably have to extend those yourself.

0

精彩评论

暂无评论...
验证码 换一张
取 消