11921: Update CultureName after language change

This commit is contained in:
Bartlomiej Komendarczuk
2022-02-24 20:24:32 +01:00
committed by Michael Latouche
parent 69132faffa
commit 9121879e1a

View File

@@ -174,6 +174,19 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
return ValidationProblem(ModelState);
}
// Update language
CultureInfo cultureAfterChange;
try
{
// language has the CultureName of the previous lang so we get information about new culture.
cultureAfterChange = CultureInfo.GetCultureInfo(language.IsoCode);
}
catch (CultureNotFoundException)
{
ModelState.AddModelError("IsoCode", "No Culture found with name " + language.IsoCode);
return ValidationProblem(ModelState);
}
existingById.CultureName = cultureAfterChange.DisplayName;
existingById.IsDefault = language.IsDefault;
existingById.FallbackLanguageId = language.FallbackLanguageId;
existingById.IsoCode = language.IsoCode;