Translator (redirect)

You are reading the AEM 6.2 version of Translator (redirect).
This documentation is also available for the following versions:  AEM 6.3  AEM 6.1  AEM 6.0  AEM 5.6.1  AEM 5.6  CQ 5.5 

CQ provides a UI console for developers to manage the various translations of texts used within CQ itself. This console is available under http://<hostname>:<port-number>/libs/cq/i18n/translator.html; for example:

    http://localhost:4502/libs/cq/i18n/translator.html

The translator allows you to create your own dictionary then manage texts and their translations. The dictionaries are created in the repository; for example:

    /apps/myproject/i18n

 

Caution

You should only edit dictionaries that have been created for your project and reside under:

    /apps

The CQ system dictionaries are also available with this tool, but they should never be updated as this might cause problems with the CQ GUI. Also, any changes made may be lost upon upgrade. The CQ system dictionaries are located under:

    /libs

The translator lists the texts used in CQ as a table with the various language translations alongside each other:

file

Searching, filtering and editing the translated texts is supported.

It also provides the capability to import and/or export Xliff files.

Creating a New Dictionary

  1. Using CRXDE Lite, add the root node (sling:Folder) for your new dictionary; i.e. the structure to hold the language definitions:

        /apps/<projectName>/i18n

    For example, /apps/myProject/i18n

  2. Add the required language structure under this root. For example:

    /apps/myProject/i18n [sling:Folder]
        - de [nt:unstructured] [mix:language]
            + jcr:language = de
        - fr [nt:unstructured] [mix:language]
            + jcr:language = fr
            

    Code samples are intended for illustration purposes only.

    Note

    This is the structure from the Sling i18n module.

  3. Reload the translator and the dictionary path (e.g. /apps/myProject/i18n) will be available in the drop-down selector in the toolbar. Select this to start adding strings and their translations.

    Note

    The translator will only save translations for languages that are actually present underneath the path (e.g. /apps/myProject/i18n).

    Make sure that these correspond to the languages shown in the grid.

Searching for Translation Texts

The search bar (at the bottom of the translator) provides you with a range of selection options:

  • Filter by text
  • Changes: Any, Modified, New, Deleted
    These are changes that have been made in the grid, but not saved yet. They are also highlighted in the grid.
    With these checkboxes you can reduce the view to only to the strings you have changed, added or removed.
  • Has Comment
  • Missing Translations
    Will show strings where at least one language does not have a translation.
file

Editing Translation Texts

  1. Select your project specific dictionary as it specifies the path in the repository holding the translations; for example, select Dictionaries as:

        /apps/myProject/i18n

    Caution

    You should only edit dictionaries that have been created for your project and reside under:

        /apps

    The CQ system dictionaries are also available with this tool, but they should never be updated as this might cause problems with the CQ GUI. Also, any changes made may be lost upon upgrade. The CQ system dictionaries are located under:

        /libs

  2. To edit the translated texts for one of the strings you can either:

    • Double click on the appropriate language for the required string to edit that single text:
    file
    • Double click on the String or Comment fields for the required string to open the Edit string dialog, edit the translation(s) as required, then click OK to close the dialog:
    file

    Caution

    You cannot edit the original String (nor the Comment) by either method, only the translations into other languages, e.g. DE, FR, IT, ES.

    If the checkbox Modify string or comment is checked a copy of the current entry will be made. This will add a new string with the modified string or comment, and all the translations will be copied over to the new entry.

    But this does not affect the original (though you could delete it later if you want).

  3. Click Save in the toolbar to commit your changes.

    Note

    Clicking on Reset & Refresh (instead of Save) will revert any changes to the prior texts.

Adding or Removing Strings

There are also options in the toolbar to Add or Remove strings.

These should be used in collaboration with your development team as:

  • adding a new string is only meaningful if they are used somewhere
  • removing a string can result in issues in the GUI

Changing Languages Listed in the Grid

The default list of languages listed in the translator grid in a standard CQ instance is:

  • de - German
  • fr - French
  • it - Italian
  • es - Spanish
  • ja - Japanese
  • zh-cn - Chinese (PRC)
  1. Using CRXDE Lite create a new node:

        /etc/languages

  2. On this node, create a property:

    • Name: languages
    • Type: Multi-String
    • Value: the list of languages you want displayed. For example:
      • fr
      • es

    Note

    The language codes must be lowercase.

  3. Click Save All in CRXDE Lite and reload the translator. The grid will be updated to show the languages defined.

    Note

    The translator will only save translations for languages that are actually present in the dictionary (i.e. underneath the dictionary path; for example, /apps/myProject/i18n).

    Make sure that these correspond to the languages shown in the grid.

Making Languages Available to Authors

After defing a dictionary for a language new to your CQ instance you need to make this available for selection by the authors (for example, for use in Preferences):

  1. To change the list of available languages available in Preferences of the Security console:

    1. Create an overlay in your application code for:
          /libs/cq/security/widgets/source/widgets/security/Preferences.js
      and update as required.
  2. To make the language available in Preferences from the Websites console you need to make the following changes in your application:

    1. Create an overlay for the structure under:
          /libs/cq/security/content/tools/userProperties
    2. Inside the overlay update the language list under:
          items/common/items /lang/options
  3. Save everything and reload the appropriate console.

Changing Language Names and Default Countries

Various countries use the same language, for example, the US, the UK and Australia all use English. This is indicated by a code indicating both language and country; for example, en_US, en_GB and en_AU.

The default countries are used when displaying flags (e.g. in the language copy dialog), they are used to resolve the country for a language code.

Note

For localizations as managed by the translator above, only the exact language works. If the language preference drop down uses en_uk, there must be a en_uk dictionary in the repository.

To change the default definitions:

  1. A language list is stored under:

        /libs/wcm/core/resources/languages

    Overlay this by copying it to:

        /apps/wcm/core/resources/languages

    Then changing or extending the list there. The property defaultCountry on a language node (e.g. ja) must contain the full code, such as ja_jp, which would define jp as the default country for the language ja.

  2. Update the CQ WCM Language Manager.

    • Language list:
      The path to the language list in the repository. Set this to the location used to overlay; i.e.
          /apps/wcm/core/resources/languages

    You can do this using the OSGi Web Console:

    http://<hostname>:<port-number>/system/console/configMgr/com.day.cq.wcm.core.impl.LanguageManagerImpl 
            

    Code samples are intended for illustration purposes only.

Any questions?

Have a question about this or any other AEM topic? Ask our Community.
Learn more about AEM topics on our help hub.
Was this helpful?

By submitting your feedback, you accept the Adobe Terms of Use.

Thank you for submitting your feedback.