The GitHub issue does mention that as a solution when running in Linux on an Azure web app. The issue has not been solved by HQ so you may want to try the workaround to see if it resolves your issue too.
The warnings come from the localization service. So by itself - in many case - it’s not REALLY an issue because it’s mostly about some localization that fails.
The issue is indeed that there is no default culture set on Linux, and the OS of containers of Web Apps in Azure are Linux based. On normal requests, Umbraco can infer the UI culture or gets is through a header. On background jobs, there obviously is no request, so Umbraco has no idea what language to use.
I don’t know the exact detailt, but you can just set a default UI language:
In Azure, set a application setting of LANG to (for instance) en_US.UTF-8. This effectively set the default language.
If you want it to set it on the application level, before app.Run() set the default languages:
CultureInfo.DefaultThreadCurrentCulture = new CultureInfo(“en-US”);
CultureInfo.DefaultThreadCurrentUICulture = new CultureInfo(“en-US”);
I haven’t tried it myself yet, but this should give you some pointers
Thanks @Luuk for that information, that’s brilliant!. That’s an option. I would prefer not to set it in Azure for each environment but its an option for sure
but this does not update the default culture when the default language is changed from the backoffice, has to restart AFAIK
i don’t know if the issue still exists in Umbraco 17, will tackle that later today probably
using System.Globalization;
using Umbraco.Cms.Core;
using Umbraco.Cms.Core.Composing;
using Umbraco.Cms.Core.Persistence.Repositories;
using Umbraco.Cms.Core.Services;
using Umbraco.Cms.Infrastructure.Scoping;
namespace YOUR_NAMESPACE;
public class DefaultCultureComposer : ComponentComposer<DefaultCultureComponent> { }
// ReSharper disable once ClassNeverInstantiated.Global
public class DefaultCultureComponent(
IRuntimeState runtimeState,
IScopeProvider scopeProvider,
ILanguageRepository languageRepository)
: IComponent
{
public void Initialize()
{
if (runtimeState.Level < RuntimeLevel.Run)
return;
using var scope = scopeProvider.CreateScope();
var defaultIsoCode = languageRepository.GetDefaultIsoCode();
var defaultCulture = new CultureInfo(defaultIsoCode);
CultureInfo.DefaultThreadCurrentCulture = defaultCulture;
CultureInfo.DefaultThreadCurrentUICulture = defaultCulture;
}
public void Terminate() { }
}