Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session
SOLVED

AEM 6.4 translation for ContentFragments not working!

Avatar

Level 1

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>

 

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Level 2

Hi @ammbra,

 

@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>

 

 

View solution in original post

8 Replies

Avatar

Community Advisor

Hi @ammbra 

 

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

Avatar

Level 1

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...

Avatar

Community Advisor

No problem @ammbra .

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

Avatar

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

Avatar

Community Advisor

Hi @ammbra , Let me check this and get back to you.

Avatar

Community Advisor

Hi @ammbra ,

 

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 

Avatar

Correct answer by
Level 2

Hi @ammbra,

 

@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>

 

 

Avatar

Level 2

Hi,

I tried adding the <assetNode> for my custom component in my custom site config translation_rules.xml but it didn't work. I then added my custom component to the global config using this : http://localhost:4502/libs/cq/translation/translationrules/contexts.html . After adding to global config, content fragments in my custom component started getting added to translation project. Is this ok ? Do we always add to global config ?

 

Thanks!