AEM 6.4 translation for ContentFragments not working!

ana-mariam85621

22-05-2020

Hello,

 

I am using AEM6.4 having the latest SP installed and I am also having several structured content fragments in my project. The text from those content fragments needs to be translated, but the AEM translation feature does not work for the content fragments (I do have a translation connector installed and configured properly, it does translate the other properties and components). Can you please help me? I have the following setup in my translation rules:

<?xml version="1.0" encoding="UTF-8"?><nodelist>
  <node path="/content">
    <property inherit="true" name="benefits" translate="true" updateDestinationLanguage="false"/>
    <property inherit="true" name="detailDescription" translate="true" updateDestinationLanguage="false"/>
    <property inherit="true" name="image/jcr:title" translate="true" updateDestinationLanguage="false"/>
    <property inherit="true" name="listLabel" translate="true" updateDestinationLanguage="false"/>
    <filter/>
    <node pathContains="/cq:annotations">
      <property name="text" translate="false"/>
    </node>
  </node>
  <node path="/content/forms">
    <property name="text" translate="false"/>
  </node>
  <node path="/content/dam">
    <property name="dc:description"/>
    <property name="dc:rights"/>
    <property name="dc:subject"/>
    <property name="dc:title"/>
    <node pathContains="/jcr:content/metadata/predictedTags">
      <property name="name"/>
    </node>
  </node>
  <node path="/content/myproject">
    <property inherit="true" name="image/jcr:title" translate="true" updateDestinationLanguage="false"/>
    <property inherit="true" name="listLabel" translate="true" updateDestinationLanguage="false"/>
    <property inherit="true" name="pageTitle" translate="true" updateDestinationLanguage="false"/>
    <property inherit="true" name="denyText" translate="true" updateDestinationLanguage="false"/>
    <property inherit="true" name="jcr:title" translate="true" updateDestinationLanguage="false"/>

    <node resourceType="myproject/components/content/atoms/content-intro">
      <property inherit="true" name="introText" translate="true" updateDestinationLanguage="false"/>
    </node>
    <filter/>
    <node pathContains="/cq:annotations">
      <property name="text" translate="false"/>
    </node>
  </node>
  <assetNode assetReferenceAttribute="fileReference" resourceType="dam/cfm/components/contentfragment"/>

  <assetNode assetReferenceAttribute="promoTooltipCFReference" resourceType="dam/cfm/components/contentfragment"/>
  <assetNode assetReferenceAttribute="tooltipContentFragmentReferenceHeadline" resourceType="dam/cfm/components/contentfragment"/>
  <assetNode assetReferenceAttribute="tooltipContentFragmentReferenceSubline" resourceType="dam/cfm/components/contentfragment"/>
  <assetNode assetReferenceAttribute="tooltipContentFragmentReferenceText" resourceType="dam/cfm/components/contentfragment"/>

</nodelist>

 

AEM6.4 bug connector content fragments fix-needed help issue translation-rules translations

Accepted Solutions (1)

Accepted Solutions (1)

LuoanaKoble

25-05-2020

Hi @ana-mariam85621,

 

@ArpitVarshney is right about the way you can include the CF in a translation if you use the OOTB component for including content fragments:

assetNode assetReferenceAttribute="fileReference" resourceType="dam/cfm/components/contentfragment"/>

But keep in mind that this works properly for AEM 6.4 only if you have a service pack grater or equal to 6.4.6. (See this one for details: https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/unable-to-translate-conten...)

 

If you use a custom component, you must add the resource type of you custom component as the assetNode resourceType (not the resource type of the field that you use for including the CF, and not the model of the CF), and the name of the property that holds the reference to the CF as your assetNode assetReferenceAttribute value (in your case, the fieldname of the pathbrowser)

assetNode assetReferenceAttribute="promoTooltipCFReference" resourceType="resource_type_of_your_custom_component"/>

After adding this, all the default properties of that CF will be translated.

Since your CF has a custom model, make sure that you add all your custom fieldnames under the /content/dam path:

<node path="/content/dam">
<property name="tooltipName"/>
</node>

 

 

Answers (1)

Answers (1)

ArpitVarshney

MVP

22-05-2020

Hi @ana-mariam85621 

 

The content of content fragments is stored in the node property called "main". You need to add this property in your translation rules file in order to send this data for translation.

Could you please add the below property in translation_rules.xml file under node path /content/dam and try it.

 

<node path="/content/dam">
<property name="main"/>
</node>

 Regards,

Arpit Varshney

Thank you @ArpitVarshney   ! I made the following changes:

<?xml version="1.0" encoding="UTF-8"?><nodelist>
  <node path="/content">
    <property inherit="true" name="benefits" translate="true" updateDestinationLanguage="false"/>
    <property inherit="true" name="detailDescription" translate="true" updateDestinationLanguage="false"/>
    <property inherit="true" name="image/jcr:title" translate="true" updateDestinationLanguage="false"/>
    <property inherit="true" name="listLabel" translate="true" updateDestinationLanguage="false"/>
    <filter/>
    <node pathContains="/cq:annotations">
      <property name="text" translate="false"/>
    </node>
  </node>
  <node path="/content/forms">
    <property name="text" translate="false"/>
  </node>
  <node path="/content/dam">
    <property name="dc:description"/>
    <property name="dc:rights"/>
    <property name="dc:subject"/>
    <property name="dc:title"/>
    <property name="defaultContent"/>
    <property name="jcr:description"/>
    <property name="jcr:title"/>
    <property name="pdf:Title"/>
    <property name="xmpRights:UsageTerms"/>
    <property name="main"/>
    <property name="tooltipName"/>
    <node pathContains="/jcr:content/metadata/predictedTags">
      <property name="name"/>
    </node>
  </node>
  <node path="/content/myproject">
    <property inherit="true" name="image/jcr:title" translate="true" updateDestinationLanguage="false"/>
    <property inherit="true" name="listLabel" translate="true" updateDestinationLanguage="false"/>
    <property inherit="true" name="pageTitle" translate="true" updateDestinationLanguage="false"/>
    <property inherit="true" name="denyText" translate="true" updateDestinationLanguage="false"/>
    <property inherit="true" name="jcr:title" translate="true" updateDestinationLanguage="false"/>

    <node resourceType="myproject/components/content/atoms/content-intro">
      <property inherit="true" name="introText" translate="true" updateDestinationLanguage="false"/>
    </node>
    <filter/>
    <node pathContains="/cq:annotations">
      <property name="text" translate="false"/>
    </node>
  </node>
  <assetNode assetReferenceAttribute="fileReference" resourceType="dam/cfm/components/contentfragment"/>
  <assetNode assetReferenceAttribute="promoTooltipCFReference" resourceType="dam/cfm/components/contentfragment"/>
</nodelist>

 

but it still does not work. I am including the content fragment in page via 

sling:resourceType="granite/ui/components/coral/foundation/form/pathbrowser"
name="./promoTooltipCFReference"

and tooltipName is a property from my content fragment:

sling:resourceType="granite/ui/components/coral/foundation/form/textfield"
name="tooltipName"

 and my content fragment is 

/conf/myproject/settings/dam/cfm/models/tooltip-cfm

 

Unfortunately, it does not work...😔

No problem @ana-mariam85621 .

Also, Please mark my reply as answer if this solved your issue so it will be good for others😀

@ArpitVarshney I amended my previous reply...I am new to posting on ExperienceLeague and I hit enter by mistake

Hi @ana-mariam85621 , Let me check this and get back to you.

Hi @ana-mariam85621 ,

 

Can you try adding your content fragment by using the Content Fragment component of the General Category and confirm whether that is working fine?

I have tried using the general Content fragment component and then select the content fragment path inside that and it works well for me. It is sending the corresponding CF to translation.

The Content Fragment component is used to hold a reference to a content fragment asset (effectively enhanced text assets).

  • The resource type for the content fragment is: dam/cfm/components/contentfragment/contentfragment
  • The reference is defined in the property: fileReference

So below translation_rule for this one is used to fetch the corresponding asset.

 

 

assetNode assetReferenceAttribute="fileReference" resourceType="dam/cfm/components/contentfragment"/>

 

 

 

<node path="/content/dam">
<property name="main"/>
</node>

 

Also, you can add just the CF in your translation job and check if that is going successfully for translation, and that way you can be sure that the translation of CF is working fine and the issue in your custom component when you refer the CF.

You can refer the OOB component located at /libs/dam/cfm/components/contentfragment if you want to achieve something like that as it contains some additional property like element, variation to recognize the content fragment.

 

Also, you might need to change your resource type in translation rules if you are not using the OOB component.

 

Regards,

Arpit