Friday, November 6, 2020

Localization in AEM

 

Localization in AEM


Many websites require content to be delivered in a localized format across multiple languages and geographies or we call them as multilingual websites

Selected Core Components make it simple to create a unified template for all of your localized content that automatically adapts based on your localized site structure.

As almost all sites require a header/footer to be present across all pages. These are generally consistent across all content of the page.

However, for a localized content page, a localized version of that header or footer needs to be displayed.


AEM provides solution for this problem:

 

Using the localization features of the Navigation Core Component and Experience Fragment Core Component along with the editable templates of AEM, this becomes a simple task.

This could be further extended to use the Language Navigation Component as well.

All of the localization features of AEM and its Core Components rely on a clear and logical content structure for localized content.

Let's also say that you author your site in English and offer it in French as well. So if you have a simple page called my-page it would be found in two localization branches in your site's content tree:



Page footers are generally made using Experience Fragments so you will need an English and French version just like your pages.

However, Experience Fragments are not pages, but are rather parts of pages that can be reused across pages, so they do not live directly under /content as the rest of your pages. Instead they live under their own folder :



since they also must be localized, their structure must mirror the localization structure of your site.


Creating page footer with Experience Fragments


The Experience Fragment Component is very flexible and is well-suited for a page header or footer.

Because our website is offered in English and French as taken example above, we will need to create two Experience Fragments, both called as footer in the locations we described previously.

 

English Footer:

/content/experience-fragments/my-site/en/footer

French Footer:

/content/experience-fragments/my-site/en/footer

 

Adding footer to view on every page:

Because the footer will appear on every page, we will need to add the Experience Fragment to our standard page template.

Our template is simply called my-template and is located with our other templates:

 

 conf/my-site/settings/wcm/templates/my-template

 

To this template we will add the basic components that we want our pages to be based on for example:

1.     Navigation component

2.     Container component

3.     Experience fragment component etc.

 

Creating Pages with created template:

By setting up the site structure and template, the content author simply needs to add the necessary content to the pages.

 

Using the templates and the localization logic of the components, the navigation and footers will be automatically added to the page and localized.

 

For example, the author would only need to add content such as a text component to the English and French pages.

 

The Navigation Component and Experience Fragment Component come from the page template and know to automatically display the correct content based on the localization structure and the location of the page itself.

 


      

 In AEM we use MSM in following cases:

·        Sites are in multiple countries.

·        Sites are in multiple languages.

·        Need to reuse/replicate same content in multiple websites.

·        Maintain consistent branding and content across websites.

 

Advantages of using MSM:

·        Easily manage multiple websites that share common content.

·        MSM allows aem developers to define relations between the sites so that content changes in one site are automatically replicated in all other sites.

·        Reduces the time to manage your websites and increases the re-use of common content.

·        Maintain common look and feel across all websites.

 

The biggest advantage of using MSM over internationalization is ease to add new languages to websites. To leverage MSM functionality a website must follow below structure:

·        The web site should have a single page as the root.

·        Each child page is the root page of each language version.

·        The name of the child page is the language code.

 

 

 

 

 

No comments:

Post a Comment