London Dev Meetup Rescheduled! Due to unavoidable reasons, the event has been moved to 21st May. Speakers remain the same—any changes will be communicated. Seats are limited—register here to secure your spot!

Reset language fallback in code

Vote:
0

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:
0

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
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.