create a language copy from one language master to another programatically. | Community
Skip to main content
Level 1
February 2, 2026
Solved

create a language copy from one language master to another programatically.

  • February 2, 2026
  • 6 replies
  • 49 views

How can i create a language copy from one language master to another programatically.

suppose i have source as  /content/project/language-master/en/home/mypage/test1/test2 and i want to create kanguage copy of  /content/project/language-master/de/home/mypage/test1 so how can i do that so all the languagecopy jcr properties also get created.

Best answer by BrettBirschbach

A couple responses here point to creating a Live Copy, but you had requested a Language Copy.  What I believe you want to do is mimic the behavior in AEM where you `Create Translation` → `Structure Only` which will create the Language Copy page with all of the source page’s current components/content, updating any path references to the path of the tree you’re creating (in your case from `/en/*` to `/de/*`.

The code that performs a translation/language copy in AEM is buried in a Workflow, and there’s no reasonable way to execute that code other than triggering the workflow (I was literally looking into this just last week on one of my projects).

 

The code to trigger the translation workflow for “structure only” is as follows:

Page sourcePage = pageManager.getPage("/content/project/language-master/en/home/mypage/test1")

WorkflowSession wfSession = Objects.requireNonNull(resolver.adaptTo(WorkflowSession.class));
WorkflowModel wfModel = wfSession.getModel("/var/workflow/models/wcm-translation/create_language_copy");

WorkflowData wfData = wfSession.newWorkflowData(Constants.TYPE_JCR_PATH, sourcePage.getPath());

Map<String, Object> wfMetaData = new HashMap<>();
wfMetaData.put("language", "de");
wfMetaData.put("projectType", "add_structure_only");
wfMetaData.put("workflowTitle", "Copy Structure \"" + sourcePage.getPath() + "\"");

wfSession.startWorkflow(wfModel, wfData, wfMetaData);

 

6 replies

kautuk_sahni
Community Manager
Community Manager
February 2, 2026

@Jineet_Vora  ​@daniel-strmecki , ​@BrettBirschbach , ​@Shashi_Mulugu , ​@Rohan_Garg ​@arunpatidar , ​@AlbinIs1 ​@chaudharynick ​@MayurSatav ​Tagging you to see if you might want to share any insights on this topic. Your expertise would be greatly appreciated, thank you!

 

Kautuk Sahni
daniel-strmecki
Community Advisor and Adobe Champion
Community Advisor and Adobe Champion
February 2, 2026

Conceptually you need to:

  1. Resolve the source blueprint page (your EN path).

  2. Resolve/ensure the target page exists (DE path), or create it

  3. Use MSM APIs to create the live relationship (or update it), which is what makes it a “real language copy” with all the right properties.

You can make use the avaliable AEM services LiveRelationshipManager and RolloutManager:

  • liveRelationshipManager.createLiveRelationship(...)
  • rolloutManager.rollout(...)

Good luck,

Daniel

AmitVishwakarma
Community Advisor
Community Advisor
February 2, 2026

Hi ​@ShikhaSo6 ,

You don’t want a plain JCR copy – you want a real language copy/live copy, so use MSM APIs, not Session.copy.

To create a real language copy (with all MSM/live copy properties) you should not use Session.copy. Instead, resolve the source (EN) page and the target (DE) parent, then use the MSM APIs to create a live relationship and roll it out. LiveRelationshipManager creates the live copy relationship and RolloutManager actually copies the content + sets all cq:LiveRelationship / cq:LiveSyncConfig metadata:

ResourceResolver resolver = ...; // service user
Resource src = resolver.getResource("/content/project/language-master/en/home/mypage/test1/test2");
Resource targetParent = resolver.getResource("/content/project/language-master/de/home/mypage/test1");

LiveRelationshipManager lrm = resolver.adaptTo(LiveRelationshipManager.class);
RolloutManager rom = resolver.adaptTo(RolloutManager.class);

lrm.createLiveRelationship(src, targetParent, null, null); // create live relationship
rom.rollout(targetParent, null, true); // rollout to copy content + MSM props
resolver.commit();

Adjust the template/paths and overloads for your AEM version, but the key point is: create a live relationship + rollout via MSM, not manual node copy.

Thanks,
Amit

Amit Vishwakarma - Adobe Commerce Champion 2025 | 16x Adobe certified | 4x Adobe SME
BrettBirschbach
Adobe Champion
BrettBirschbachAdobe ChampionAccepted solution
Adobe Champion
February 2, 2026

A couple responses here point to creating a Live Copy, but you had requested a Language Copy.  What I believe you want to do is mimic the behavior in AEM where you `Create Translation` → `Structure Only` which will create the Language Copy page with all of the source page’s current components/content, updating any path references to the path of the tree you’re creating (in your case from `/en/*` to `/de/*`.

The code that performs a translation/language copy in AEM is buried in a Workflow, and there’s no reasonable way to execute that code other than triggering the workflow (I was literally looking into this just last week on one of my projects).

 

The code to trigger the translation workflow for “structure only” is as follows:

Page sourcePage = pageManager.getPage("/content/project/language-master/en/home/mypage/test1")

WorkflowSession wfSession = Objects.requireNonNull(resolver.adaptTo(WorkflowSession.class));
WorkflowModel wfModel = wfSession.getModel("/var/workflow/models/wcm-translation/create_language_copy");

WorkflowData wfData = wfSession.newWorkflowData(Constants.TYPE_JCR_PATH, sourcePage.getPath());

Map<String, Object> wfMetaData = new HashMap<>();
wfMetaData.put("language", "de");
wfMetaData.put("projectType", "add_structure_only");
wfMetaData.put("workflowTitle", "Copy Structure \"" + sourcePage.getPath() + "\"");

wfSession.startWorkflow(wfModel, wfData, wfMetaData);

 

BrettBirschbach
Adobe Champion
Adobe Champion
February 2, 2026

Added `languageCopyPath` to the `wfMetaData` - in some cases you need it, in some cases you dont.  Probably safest to include it.

BrettBirschbach
Adobe Champion
Adobe Champion
February 2, 2026

Actually scratch that - we were adding `languageCopyPath` for reasons of custom code.  I dont think you actually need that...it creates the page in the same path as the source page, just replacing `/en` with `/de` similar to if you do it from the sites.html UI.

giuseppebaglio
Level 10
February 2, 2026

hi ​@ShikhaSo6

For full translation integration, you can start the OOTB "WCM: Create Language Copy" workflow programmatically:

WorkflowSession workflowSession = resolver.adaptTo(WorkflowSession.class);
WorkflowModel model = workflowSession.getModel("/libs/settings/workflow/models/wcm-translation/create_language_copy");
WorkflowData data = workflowSession.newWorkflowData("JCR_PATH", sourcePath);
Map<String, Object> meta = new HashMap<>();
meta.put("language", "de"); // Target lang; customize payload
workflowSession.startWorkflow(model, data, meta);

 

Shashi_Mulugu
Community Advisor
Community Advisor
February 2, 2026

@ShikhaSo6 as far i know language copy is nothing different than a regular copy apart from a couple of extra arguments such as target path jcr language and making sure it matches with your needed and a cq:translationsource property poinying to source page path. So if you do it programmatically and enforce language root restrictions, its a just a regular copy but if dont want to risk it with aem internal apis safe to run create language copy workflow programmatically