Try our conversational search powered by Generative AI!

Get Translated content from a Page using 6 R2

Vote:
 

Hi, 
Ia m looping through the Composer blocks on my page and I need to get the Welsh Translated content from the block - but no matter what i use I always get the English. Can you see in my code where Im going wrong:

PageDataCollection allLanguages = DataFactory.Instance.GetLanguageBranches(child.PageLink); 
foreach (var tt in allLanguages.Where(x => x.LanguageID == child.LanguageID)) 
{ 

try 
{ 
ExtensionPageData page = ExtensionPageData.Load(tt.PageLink); 
if (page != null && page.AreaCount > 0) 
{ 
List functions = page.GetAllContentFunctions(true); 
if (functions.Count > 0) 
{ 
foreach (var item in functions) 
{

ContentFunctionReference cfr = new ContentFunctionReference(item.FunctionID, item.WorkID); 
PageData pdCurrent = EPiServer.DataFactory.Instance.GetPage(cfr, new LanguageSelector(tt.LanguageID)); 
if (pdCurrent.PageTypeName == "[ExtensionSys] Text") 
{ 
var pd = pdCurrent.GetPageLanguage(pdCurrent.LanguageID); 
output += pdCurrent.Property["Content"].ToString() + " ^^^ " + tt.PageLink.ID + " -- " + child.LanguageID; 
} 
} 
} 
else 
{ 
output = "NOTHING"; 
} 
} 
} 
catch (Exception ex) 
{

} 
}

 

Thanks

Jon

#151578
Jul 29, 2016 12:08
Vote:
 

It must be possible

#151591
Jul 29, 2016 18:26
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.