One thing that might be a good addition is adding Fallback.ToDefaultLanguage, so you can get a fallback value from the default language without configuring the fallback chain on the languages themselfs.
Looking at the code and comments in this class, it already requires some attention. Most of the logic can be moved into a base class, so replacing it with a custom implementation (e.g. using a custom language fallback chain or recurse ancestors & languages) can be written a lot easier!
As discussed in https://github.com/OurModelsBuilder/Our.ModelsBuilder/issues/206 and https://github.com/OurModelsBuilder/Our.ModelsBuilder/issues/235, the current options to get fallback values are quite minimal or very verbose. Some things can be fixed within Models Builder (e.g. generating additional extension methods accepting fallback options), customizing the model classes or even replacing the
IPublishedValueFallback
.One thing that might be a good addition is adding
Fallback.ToDefaultLanguage
, so you can get a fallback value from the default language without configuring the fallback chain on the languages themselfs.The default
PublishedValueFallback
implementation already depends onILocalizationService
, so getting the default langauge can be done using_localizationService.GetDefaultLanguageIsoCode()
: https://github.com/umbraco/Umbraco-CMS/blob/51d7ce0dc6e7dbcfd0c85e3f6e863139fb545635/src/Umbraco.Web/Models/PublishedContent/PublishedValueFallback.cs#L21-L25Looking at the code and comments in this class, it already requires some attention. Most of the logic can be moved into a base class, so replacing it with a custom implementation (e.g. using a custom language fallback chain or recurse ancestors & languages) can be written a lot easier!