AEM 6.4 translation for ContentFragments not working! | Community
Skip to main content
ammbra
May 22, 2020
Solved

AEM 6.4 translation for ContentFragments not working!

  • May 22, 2020
  • 2 replies
  • 7403 views

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>

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by LuoanaKoble

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-content-fragments/qaq-p/310732)

 

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>

 

 

2 replies

ArpitVarshney
Community Advisor
Community Advisor
May 22, 2020

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

ammbra
ammbraAuthor
May 22, 2020

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

LuoanaKobleAccepted solution
Level 2
May 25, 2020

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-content-fragments/qaq-p/310732)

 

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>

 

 

Level 2
March 8, 2021

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!