AI OnAI Off
Hi ChiChing,
You're going to have to do some kind of migration here.
Because they are so similar, I think the easiest way to do it is via SQL. Messing around with it a little, the following seems to work:
DECLARE @LanguageId int;
DECLARE @OldContentTypeId int;
DECLARE @NewContentTypeId int;
DECLARE @OldPropertyDefinitionId int;
DECLARE @NewPropertyDefinitionId int;
BEGIN
SET @LanguageId = (SELECT TOP 1 pkID FROM dbo.tblLanguageBranch WHERE LanguageID = 'en')
SET @OldContentTypeId = (SELECT TOP 1 pkID FROM dbo.tblContentType WHERE ModelType LIKE '%.ImageFile%')
SET @NewContentTypeId = (SELECT TOP 1 pkID FROM dbo.tblContentType WHERE ModelType LIKE '%.LocalizedImageFile%')
SET @OldPropertyDefinitionId = (SELECT TOP 1 pkID FROM dbo.tblPropertyDefinition WHERE fkContentTypeID = @OldContentTypeId AND Name = 'AlternateText')
SET @NewPropertyDefinitionId = (SELECT TOP 1 pkID FROM dbo.tblPropertyDefinition WHERE fkContentTypeID = @NewContentTypeId AND Name = 'AlternateText')
END
PRINT CONCAT('Language ID.................. ', @LanguageId)
PRINT CONCAT('Prev Content Type ID......... ', @OldContentTypeId)
PRINT CONCAT('New Content Type ID.......... ', @NewContentTypeId)
PRINT CONCAT('Prev Property Definition ID.. ', @OldPropertyDefinitionId)
PRINT CONCAT('New Property Definition ID... ', @NewPropertyDefinitionId)
UPDATE
dbo.tblWorkContent
SET
fkLanguageBranchID = @LanguageId
WHERE
fkContentID IN (SELECT pkID FROM dbo.tblContent WHERE fkContentTypeID = @OldContentTypeId)
UPDATE
dbo.tblContentLanguage
SET
fkLanguageBranchID = @LanguageId
WHERE
fkContentID IN (SELECT pkID FROM dbo.tblContent WHERE fkContentTypeID = @OldContentTypeId)
UPDATE
dbo.tblContentProperty
SET
fkPropertyDefinitionID = @NewPropertyDefinitionId,
fkLanguageBranchID = @LanguageId
WHERE
fkPropertyDefinitionID = @OldPropertyDefinitionId
UPDATE
dbo.tblWorkContentProperty
SET
fkPropertyDefinitionID = @NewPropertyDefinitionId
WHERE
fkPropertyDefinitionID = @OldPropertyDefinitionId
UPDATE
dbo.tblContent
SET
fkMasterLanguageBranchID = @LanguageId,
fkContentTypeID = @NewContentTypeId
WHERE
fkContentTypeID = @OldContentTypeId
You'll want to set the "en" near the top to whatever the master website language is (and whatever language your alt texts are in), there are a few other things there you may want to tweak based on your requirements.
Of course, no guarantees - but I'm sure you were gonna back up the database anyway 😊
Hi guys,
I have problem to change alt text property in the existing ImageFile class to culture specific.
I found this topic in episerver (https://world.episerver.com/forum/developer-forum/-Episerver-75-CMS/Thread-Container/2016/6/image-/)
I tried first to moidy the existing ImageFile and it didn't work. I created a new contenttype "LocalizedImageFile" and implement ILocalizable interface class instead.
My question is what shall I do with the existing images which are "ImageFile" type?
I tried to upload a new picture and it still ImageFile type, not LocalizedImageFile.
Or any other tips to set culture specific alt text on an image?
Thanks,
ChiChing