Page tree
Skip to end of metadata
Go to start of metadata

The Magnolia Urltranslation module builds off the previous Urltrans Module. This version is meant for community edition. The idea of the module is to provide a way to translate the page names in a single-tree-multi-langauge website. See enabling multilanguage content for how to set up this type of website. Using the translation module together with your translated website you can internationalize your URLs.

Installing

(warning) Magnolia 5.6+

Maven is the easiest way to install the modules. Add the following dependencies to your bundle:

<dependency>
  <groupId>info.magnolia.i18n</groupId>
  <artifactId>magnolia-urltranslation</artifactId>
  <version>5.6</version>
</dependency>

SCM

The source code for the URL Translation module can be found here: https://git.magnolia-cms.com/projects/FORGE/repos/urltranslation/browse

Jira

Report issues here: URLTRANS

Javadocs

Usage

This module expects to find the translated names of pages in an internationalized field called name. Consider this example from the MTE module.

/mte/dialogs/pages/pageProperties.yaml
form:
  tabs:
    - name: tabMain
      fields:

        # Here we add the name field to the page properties dialog.
        - name: name
          class: info.magnolia.ui.form.field.definition.TextFieldDefinition
          i18n: true

        - name: title
          class: info.magnolia.ui.form.field.definition.TextFieldDefinition
          i18n: true
        - name: navigationTitle
          class: info.magnolia.ui.form.field.definition.TextFieldDefinition
          i18n: true
        - name: hideInNav
          class: info.magnolia.ui.form.field.definition.CheckboxFieldDefinition
          defaultValue: false
          i18n: false
          type: Boolean
        - name: windowTitle
          class: info.magnolia.ui.form.field.definition.TextFieldDefinition
          i18n: true
    - name: tabMeta
      fields:
        - name: keywords
          class: info.magnolia.ui.form.field.definition.TextFieldDefinition
          i18n: true
          rows: 3
        - name: description
          class: info.magnolia.ui.form.field.definition.TextFieldDefinition
          i18n: true
          rows: 5

actions:
  commit:
    class: info.magnolia.ui.admincentral.dialog.action.SaveDialogActionDefinition
  cancel:
    class: info.magnolia.ui.admincentral.dialog.action.CancelDialogActionDefinition

Migrating

For those coming from the older Forge version of the module I would suggest that you uninstall that module before moving to 5.6.

  1. Delete the filter /server/filters/cms/urltrans
  2. Change the class property of /server/rendering/linkManagement
    • Community and EE std: info.magnolia.link.LinkTransformerManager
    • Pro: info.magnolia.multisite.MultiSiteLinkTransformerManager
  3. Change the class property of /server/rendering/linkManagement/transformers/absolute
    • info.magnolia.link.AbsolutePathTransformer
  4. Remove the module.

Changelog

  • Version 5.6
    • STK dependency removed from old Forge version.
    • Content API removed from old Forge version. 
    • Vaadin 8 compatible.
  • No labels

7 Comments

  1. Hello Richard Gange,

    Is the provided maven config correct? I haven't been able to import the module correctly.

    The libs seem to be there but the jar not. The only way would be to download the sources.

    Thanks

    1. Hi Guillermo-

      At the moment you need a nexus account with EE privileges. Next week let me see about making the magnolia-url-translation module available to the community.

      Cheers

    2. A community edition has been released in the forge. Cheers!

  2. Richard Gange we get a Report form a Partner that maven can not find magnolia-services-base parent pom. Could you check if there is a problem with the dependencys? Thnx.

    BG Dominik

    1. A community edition has been released in the forge. Cheers!

  3. To get a link to a page in an another language you may use a code like this:

     public String samePageUrlLink(String nodeIdentifier, String locale) throws RepositoryException {
        Node node = templatingFunctions.nodeById(nodeIdentifier);
        Map<String, String> ll = templatingFunctions.localizedLinks(node);
        for (Map.Entry<String, String> entry : ll.entrySet()) {
            String key = entry.getKey();
            String value = entry.getValue();
            if (key.equals(locale)) {
                return value;
            }
        }
        return StringUtils.EMPTY;
    }
    1. To alter the out-of-the-box Magnolia Pages App "New Page" dialog, add the new property "name" there: