Technical ManualsRemove Web Store Language

Remove Web Store Language

Sana Commerce 9.3
Your connector

How to Remove a Web Store Language

When not all installed languages of the webstore are needed, they can be removed. To remove a webstore language you can execute the SQL script on your database. This script will remove the content written in the specific language and the language itself.
 
To remove a webstore language:

Step 1: Locate the variable '@LanguageId' in the SQL script below and specify the locale ID of the language which should be removed. The language IDs can be found in the 'Languages' table of the Sana Commerce SQL database. This script can be also downloaded as the SQL file.

Step 2: Execute the SQL script on the Sana Commerce database to remove the specified webstore language:

BEGIN TRANSACTION
BEGIN TRY
  DECLARE @languageId int;
  SET @languageId = 1043; /* the Locale ID of the language which should be removed */
  IF ((SELECT count(Id) FROM Languages WHERE Id = @languageId AND IsDefault = 1) > 0)
  BEGIN
   raiserror('ERROR: language %d is a system default language!', 11, 1, @languageId)
  END
  IF ((SELECT count(id) FROM Websites WHERE DefaultLanguageId = @languageId) > 0)
  BEGIN
   raiserror('ERROR: language %d is used as default for website!', 11, 1, @languageId)
  END
    --Delete all translations
  DELETE FROM ItemTranslations
  WHERE LanguageId = @languageId;
  --Delete WebsiteLanguages
  DELETE FROM WebsiteLanguages
  WHERE LanguageId = @languageId
  --Delete SanaTexts
  DELETE FROM SanaTexts
  WHERE LanguageId = @languageId
  --Delete MailTemplates
  DELETE FROM MailTemplates
  WHERE LanguageId = @languageId
  ------------
  --Delete Languages
  DELETE FROM Languages
  WHERE Id = @languageId;
END TRY
BEGIN CATCH
  PRINT ERROR_MESSAGE() + ' Transaction rolled back.'
  IF @@TRANCOUNT > 0
   ROLLBACK TRANSACTION
END CATCH
GO
IF @@TRANCOUNT > 0
COMMIT TRANSACTION
GO
Technical ManualsRemove Web Store Language