Try our conversational search powered by Generative AI!

Changing master language in episerver commerce


I'm exprimenting...

After an upgrade from 5.2 to 8.2, I need to change the default language from "en-us" to "en". We don-t want to have that US english version. I have ran some script to the dbase so the routing works fine:

 Update   FROM [dbHolmenCommerceManager].[dbo].[Catalog] set defaullanguage= 'en'
update [dbHolmenCommerceManager].[dbo].[main_LanguageInfo] set defaullanguage= 'en'

Update [dbHolmenCommerceManager].[dbo].[CatalogItemSeo] set [LanguageCode] = 'en' where [LanguageCode] = 'en-US'

 update [dbHolmenCommerceManager].[dbo].[CatalogEntryEx_DefaultProduct_Localization] set [Language] = 'en' where [Language] = 'en-US'

  update [dbHolmenCommerceManager].[dbo].[CatalogEntryEx_DefaultVariation_Localization] set [Language] = 'en' where [Language] = 'en-US'

update [dbHolmenCommerceManager].[dbo].[CatalogNodeEx_DefaultCatalog_Localization] set [Language] = 'en' where [Language] = 'en-US'

NOW... How do i change for example the metadatafield "Description" (multilagual property on Entry) so the text shows automaticly on "en" version? And how do i remove the en-US version of the product? in the UI its not possible, maybe because it is the master?.


Dec 05, 2014 15:36

I'm not sure we recommend to do this - but if you follow that path, then there's one thing you need to update.

In Commerce database, there's multiple tables named such as CatalogEntryEx_<you_meta_class>_Localization and CatalogNodeEx_<you_meta_class>_Localization

You will need to update Language columns of those table to en instead of en-us.

And of course - you should back up your database first.



Edited, Dec 08, 2014 4:16

To be strict, we never recommend working direclty with the database. If the operation not possible through the API:s it's not supported. Everything is done at your own risk.

In addition to the mentioned tables the DDS tblBigTable may contain draft versions of catalog content (CatalogContentDraft) if you've been updating the catalog through the new catalog UI or the Content API:s after the upgrade. I think it will be harder to update those direcly in the database, though it might be possible working with the view and I think we keep the language information in separate columns. Dropping all of the CatalogContentDraft instances them might be an option (DO NOT drop the entire tblBigTable though, it contains many other types of data), but that might be challenging as well as they may span multiple rows.

Dec 08, 2014 8:10

OK, thanks guys.

I can see the versions in DDS (CatalogContentDraft). but where is the metafield translations?

Maybe it is an good idea to wright a job in API that gets all en-US translations on entry, saves to en, and deletes the en-US translations. But the remaining question is if this deletes the (en-us) field in Commerce UI and new Catalog UI.

Edited, Dec 08, 2014 10:00

The new Catalog UI seem to be flexible. When i've switch language in DDS (CatalogContentDraft), it only shows "en" version in UI. GOOD.

But the thing is that we have NOT used the new Catalog UI, then in Commerce UI, it shows both fields... Description (en): and Description (en-us).

I can't figure out how to disable the empty "Description (en-us)" fields.

Edited, Dec 08, 2014 11:01

To disable language fields in UI, just change the LangCode in table CatalogLanguage.

Still it seems that new Catalogue UI does not get the data as in Commerce UI, until i save the data in Commerce UI.

Dec 08, 2014 19:00

For the record: This worked for me. But remember, this is not something Episerver supports... anyhow..

The right SQL:

update [dbHolmenCommerceManager].[dbo].[Catalog] set defaultlanguage= 'en'
update [dbHolmenCommerceManager].[dbo].[main_LanguageInfo] set LangName= 'en' where LangName= 'en-us'

update [dbHolmenCommerceManager].[dbo].[CatalogItemSeo] set [LanguageCode] = 'en' where [LanguageCode] = 'en-US'

update [dbHolmenCommerceManager].[dbo].[CatalogEntryEx_DefaultProduct_Localization] set [Language] = 'en' where [Language] = 'en-US'

update [dbHolmenCommerceManager].[dbo].[CatalogEntryEx_DefaultVariation_Localization] set [Language] = 'en' where [Language] = 'en-US'

update [dbHolmenCommerceManager].[dbo].[CatalogNodeEx_DefaultCatalog_Localization] set [Language] = 'en' where [Language] = 'en-US'

update [dbHolmenCommerceManager].[dbo].[CatalogLanguage] set [LanguageCode] = 'en' where [LanguageCode] = 'en-US'
update [dbHolmenCommerceManager].[dbo].[MarketLanguages] set [LanguageCode] = 'en' where [LanguageCode] = 'en-US'
update [dbHolmenCommerceManager].[dbo].[PromotionLanguage] set [LanguageCode] = 'en' where [LanguageCode] = 'en-US'
update [dbHolmenCommerceManager].[dbo].[TaxLanguage] set [LanguageCode] = 'en' where [LanguageCode] = 'en-US'

I did make a script that iterated all my entries (Not the SKUs)... so foreach entrydto:

      protected void TranslateEntryFromUSToEN(CatalogEntryDto entrydto)
            CultureInfo oldUICulture = Thread.CurrentThread.CurrentUICulture;
            Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US");//Set Lang en-us or your old language

            Entry entry = CatalogContext.Current.GetCatalogEntry(entrydto.CatalogEntry[0].CatalogEntryId);

            string[] desc = entry.ItemAttributes[Constants.EntryAttributeKey.Description].Value;
            string[] shorts = entry.ItemAttributes[Constants.EntryAttributeKey.ShortDescription].Value;
            string[] dn = entry.ItemAttributes[Constants.EntryAttributeKey.DisplayName].Value;

            CatalogEntryDto entry2 = CatalogContext.Current.GetCatalogEntryDto(entry.ID,
                  new CatalogEntryResponseGroup(CatalogEntryResponseGroup.ResponseGroup.CatalogEntryInfo));

            Thread.CurrentThread.CurrentUICulture = oldUICulture;
            MetaDataContext metaContext = MetaDataContext.Instance;
            //metaContext.UseCurrentThreadCulture = false;
            //CatalogContext.MetaDataContext.Language = "en";
            MetaObjectSerialized serialized = new Mediachase.Commerce.Storage.MetaObjectSerialized();
            MetaObject metaObj = MetaObject.Load(metaContext, entry.CatalogEntryId, 27); // 27 = my defaultproduct
            MetaHelper.SetMetaFieldValue(metaContext, metaObj, Constants.EntryAttributeKey.DisplayName, dn); // my contants
            MetaHelper.SetMetaFieldValue(metaContext, metaObj, Constants.EntryAttributeKey.Description, desc);
            MetaHelper.SetMetaFieldValue(metaContext, metaObj, Constants.EntryAttributeKey.ShortDescription, shorts);

            serialized.AddMetaObject("en", metaObj);

            foreach (CatalogEntryDto.CatalogEntryRow row in entry2.CatalogEntry.Rows)
                if (row.MetaClassId == 27)// 27 = my defaultproduct
                    row.SerializedData = serialized.BinaryValue;

            CatalogContext.MetaDataContext.UseCurrentThreadCulture = true;


I had also to remap all images to the new media handling and add it to myProduct.CommerceMediaCollection, but thats another question, i followed this thread.

Edited, Jan 07, 2015 15:43
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.