volume_up

A critical vulnerability was discovered in React Server Components (Next.js). Our systems remain protected but we advise to update packages to newest version. Learn More

AI OnAI Off

Reset language fallback in code

I have a site with a complex series of langauge fallbacks. I have set theis on the Root item. However, there are some blocks that were created before I set up the rules on Root so they have different rules. I would like to create a schedule job to loop throuh all blocks and pages and basically 'check' the inherit settings from parent. Can this be set in code?

#276007
Mar 09, 2022 21:23
Vote:

Hi Ethan,

This should be possible using the ContentLanguageSettingRepository (EPiServer.DataAbstraction).

As far as I'm aware, if content inherits language settings from it's parent then it has no ContentLangaugeSetting. So I believe you'd want to do something like this (which I'll caveat by saying I haven't tested at all):

var languageSettings = _contentLanguageSettingRepository.Load(contentLink);

if (languageSettings == null)
{
	return;
}

foreach (var languageSetting in languageSettings)
{
	_contentLanguageSettingRepository.Delete(contentLink, languageSetting.LanguageBranch);
}
#276049
Mar 10, 2022 10:30
error This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* 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.