Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

Globalization/Translation behaviour

Vote:
 

Hi 

 

When you localise a page/block to a target culture the translatable fields are emptied, and you have to re-enter them.

Is this the expected behaviour?

As a page/block can contain a lot of translatable fields this forces the end user to enter the translation there and then, block-by-block and page-by-page.

Our client would like to globalise content from english to a target culture without being forced to change it, i.e. copy the english content from en-GB to de-DE say, and then allow translation teams to change the english copy to their native tongue at a later date before publishing the content.

It is also easier for their translation teams if they see the original english master copy in the block/page they are going to translate.

If the abvoe is the expected behviour for translating/globalising pages/blocks in CMS 7.1, can we override it so that when you globalise content from one language branch to another the content is copied from the source culture page/block to the destination culture page/block?

Could we achieve this behaviour using workflows?

 

Thanks

Martin Graney

#72335
Jun 13, 2013 11:59
Vote:
 

Hi

What you could do is hook up an event handler to LoadedDefaultContent and check if ContentLink is not null or empty (that is what differs a new language version of a page from a new page). And if so copy all values from master language, something like:

[ModuleDependency(typeof(EPiServer.Web.InitializationModule))]
public class PopulateLanguage : IInitializableModule
{
public void Initialize(Framework.Initialization.InitializationEngine context)
{
  context.Locate.Advanced.GetInstance<IContentEvents>().LoadedDefaultContent
     += delegate(object sender, ContentEventArgs args)
    {
      if (!ContentReference.IsNullOrEmpty(args.ContentLink))
      {
          //For a new language branch will contentLink not be empty
        var masterLanguage = context.Locate.ContentLoader()
           .Get<IContent>(args.ContentLink,
                        LanguageSelector.MasterLanguage());
       foreach (var prop in masterLanguage.Property
                .Where(p => p.IsLanguageSpecific && !p.IsMetaData))
      {
          args.Content.Property[prop.Name].Value = prop.Value;
      }
   }
  };
}

public void Preload(string[] parameters)
{
}

public void Uninitialize(Framework.Initialization.InitializationEngine context)
{
}

#72348
Jun 13, 2013 14:43
Vote:
 

Also take a look at this: http://cjsharp.com/blog/2013/04/19/automatically-populating-page-or-block-type-properties-for-a-language-branch-in-episerver-7/

It's an attribute so you can specify content copying on a per-property basis.

#72371
Jun 14, 2013 12:13
Vote:
 

Hi Chris,

 

I`ve tried your solution but always when I hit translate the e.Content.ContentGuid is empty.

Do you know what can cause the problem?

 

Thanks,
Daniel

#72548
Jun 20, 2013 12:29
Vote:
 

Hi Johan

 

We tried your approach and the ContentLink is always null/empty. 

We noticed that this happens on pages/blocks that have [Required] properties.

As we use [Required] to force the content admins to add the required master content, this is not a usable solution.

When we have a page/block with no [Required] properties it fires the twice, with the first time ContentLink being null, and the second being the actual ContentLink ID of the page/block.

I am guessing this is because of the flow of execution. 

As we never see the second request in content with a [Required] field, then I am assuming the system attempts to create a blank content type, cannot do so because of the [Required] fields, and so never actually gets to the second call to LoadedDefaultContent which would populate the content.

Are you aware of this behaviour, or are you aware of a work around?

Thanks

Marin Graney

 

 

#72555
Jun 20, 2013 16:10
Vote:
 

@Daniel: Are you using EPiServer 7.1? Are you trying to translate a page or a block?

#72565
Jun 20, 2013 20:40
Vote:
 

@Chris, we are using 7.1 and we get it with both blocks and pages. 

 

#72578
Jun 21, 2013 13:53
Vote:
 

Are there any updates on this subject. It's something I also would like to know.

Personally I find it strange the "page to be translated" is empty. I would expect it to have the original not translated content for reference.

Gert

#113007
Nov 10, 2014 14:29
Vote:
 

Are there any updates for this?

We have the exact same issue and required properties are not automatically passed through. We can't do anything about it as the data doesn't appear to be there, on the first pass (ContentLink is empty/null), but IS available, on the second pass, to fill in the rest of the properties.

This is for an Episerver 7.5 site.

#140595
Oct 23, 2015 17:32
Vote:
 

Have you tried using the Translation Add-on? It gives you the option to copy content from another language.

#140611
Oct 25, 2015 13:42
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.