-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Description
Which Umbraco version are you using?
16.3.3
Bug summary
I've been working on a v16 site due to launch soon. Early on there was some confusion with the needed languages on the site, and ended up having the default language set to Danish (da-DK).
After a while it was decided it should be English (en-GB) instead. In v13, you could just go to the language and choose another in the dropdown:
However, now in v16 it is no longer a dropdown, and there are no apparent ways to swap:
Initially I thought it would be enough to simply swap the languages in the database, as it seemed like everything was based on the language ids.
However, after doing that I found that with the introduction of variant blocklists they now contain a reference to the culture string instead of the language id - here is a shortened example:
{
"contentData": [
{
"contentTypeKey": "49168f20-c6e4-4aee-a02a-068575e4fff8",
"udi": null,
"key": "e45a72ee-0f43-4e85-b827-612c4a5ec5fd",
"values": [
{
"editorAlias": "Umbraco.RichText",
"culture": null,
"segment": null,
"alias": "headline",
"value": "{\u0022markup\u0022:\u0022\\u003Cp\\u003ESales \\u0026amp; Technology Offices\\u003Cstrong\\u003E Europe\\u003C/strong\\u003E\\u003C/p\\u003E\u0022,\u0022blocks\u0022:null}"
}
]
}
],
"settingsData": [],
"expose": [
{
"contentKey": "e45a72ee-0f43-4e85-b827-612c4a5ec5fd",
"culture": "da-DK",
"segment": null
}
],
"Layout": {
"Umbraco.BlockList": [
{
"contentUdi": null,
"settingsUdi": null,
"contentKey": "e45a72ee-0f43-4e85-b827-612c4a5ec5fd",
"settingsKey": "d1e914ab-9a86-4fcf-bb53-ae43a68627ec"
}
]
}
}The expose object contains the culture strings on which it should be shown.
I've gotten it to work by running these queries against my db:
UPDATE pd
SET pd.textValue = REPLACE(pd.textValue, '"culture":"da-DK"', '"culture":"en-GB"')
FROM [umbracoPropertyData] pd
INNER JOIN umbracoContentVersion cv
ON pd.versionId = cv.id
WHERE cv.[current] = 1
AND pd.textValue LIKE '%"expose":%'
AND pd.textValue LIKE '%"culture":"da-DK"%';
UPDATE [umbracoLanguage]
SET
languageISOCode = 'TEMP-SWAP',
languageCultureName = 'Temporary Swap Value',
isDefaultVariantLang = 0,
mandatory = 0,
fallbackLanguageId = NULL
WHERE id = 2;
UPDATE [umbracoLanguage]
SET
languageISOCode = 'da-DK',
languageCultureName = 'Danish (Denmark)',
isDefaultVariantLang = 0,
mandatory = 0,
fallbackLanguageId = NULL
WHERE id = 4;
UPDATE [umbracoLanguage]
SET
languageISOCode = 'en-GB',
languageCultureName = 'English (United Kingdom)',
isDefaultVariantLang = 1,
mandatory = 0,
fallbackLanguageId = 3
WHERE id = 2;But even after that I had to go and manually publish several nodes with descendants, rebuild all caches and restart a couple of times to get it to work.
Oh also it apparently generated a bunch of new redirects in the umbracoRedirectUrl which I could luckily just truncate as the site is not live yet.
I hope this could return as a feature within the backoffice! Or atleast that the block data follows everything else that uses the language ids so it becomes less involved to move languages around.
Specifics
No response
Steps to reproduce
Set up a new site with multiple languages and blockslists, then try to change the language as descibed above.
Expected result / actual result
No response