Translation Rules Generator is an AEM tool to create the first draft of translation rules required to start page translation.Translation rules identify the content to translate for pages, components, and assets that are included in, or excluded from, translation projects. When a page or asset is being translated, AEM extracts this content so that it can be sent to the translation service.The components created for AEM websites can be large in numbers. Manually creating these rules for each component is a time taking task and requires lots of effort. The tools makes this easy by just taking few inputs and it generates the translation rules for you.
What it does?
Translation rules generator saves you from manual work and efforts required to create the Translation rule file. The translation rule file identifies the content to be send for translation using any implemented AEM Translation Connector.You can read more about translation rule file from adobe official documentation : https://docs.adobe.com/docs/en/aem/6-2/administer/sites/translation/tc-rules.html .
Consider the node in nodelist of translation rules file :
<!-- translation rules for Geometrixx Outdoors site (example) -->
<node resourceType ="foundation/components/image">
<property name="jcr:title" />
<node resourceType ="geometrixx-outdoors/components/title">
As per rule, for pages under the path “/content/geometrixx-outdoors” ,the properties “alternateText” and “jcr:title” for component resolved using resourceType “foundation/components/image” would be sent for translation.
Translation Rules Generator generates these rules for you by just taking some simple inputs.
If we consider the cq:dialog of the component /libs/foundation/components/image, there are several properties that are authorable like file path, title, alternative text and many more.If we take the broad view, title and alternative text both are having resourceType “granite/ui/components/foundation/form/textfield” and xtype “textfield” in case of Classic UI and the property file with resourceType “granite/ui/components/foundation/form/fileupload” or xtype “fileupload” generally not sent for translation.
So, we can say that there are some particular resourceTypes for Touch UI dialog and xtypes for Classic UI dialog whose “name” property field value is send for translation.This is the concept we are using in this generator to generate rules.The generator also identifies the property in these two cases :
- If dialog contains xtype “cqinclude” or resourceType “granite/ui/components/foundation/include” : Generator also identifies the property in the dialog parts included via cqinclude or granite/ui/components/foundation/include
- If the component has sling:resourceSuperType : There can be case when component is inheriting its dialog from parent or some fields of the component dialog are defined in the parent.Generator also identifies properties in this too.
Go to “http://<HOST>:<PORT>/system/console/configMgr” to access OSGI Configurations console.
Dialog Xtypes and ResourceTypes
- Xtypes (Classic UI) : Some xtypes are configured by default like textfield and textarea for which “name” property value is send for translation.Add any custom or OOTB xtypes.
- ResourceTypes (Touch UI) : Some resourceTypes are configured by default like granite/ui/components/foundation/form/textfield and granite/ui/components/foundation/form/textarea for which “name” property value is send for translation.Add any custom or OOTB resourceTypes.
Translation rules generator
- Go to http:/<host>:<port>/projects.html/content/projects and click on “Adobe Experience manager” label.
- Click on Tools icon -> Translation -> “Generate Translation Rules” Option.
- There are several input parameters to be filled to generate translation rules:
Content Path: The path under which all your content/pages lie which are to be sent for translation, the default is taken as “/content”.
Components Path: It is multivalued field and it requires the paths in the repository under where the components lie which are to be sent for translation.
Classic UI Xtypes: some of the xtypes are already filled for you , these are the xtypes configured in Dialog Xtypes and ResourceTypes Configuration in Admin console. You can delete them or add more xtypes here.
Touch UI ResourceTypes: some are already filled for you, add more resourceTypes here.
After giving the inputs,click on Generate button on the right top of the screen.All generated rules will be displayed.Make changes as required and copy them using Copy button to paste them in Translation rules files present at path “/etc/workflow/models/translation/translation_rules.xml”