0

I'm using Sitecore 9 and SXA 1.7.

I can set the default language of the site at Site Grouping:

enter image description here

I want to know where to set the language programmatically in SXA. Which dll to use, as I want to override this behavior?

3
  • Are you trying to just change Context Language? Why do you need to change language on site programatically? Feb 25 '19 at 7:08
  • I saved the user's last opened language, I want the site to be opened in the user's last language when the browser is closed and opened again, so I want to set the language from the SXA pipeline, as when I set it using jquery cookies, the performance was poor. Feb 25 '19 at 7:42
  • I think that setting Language cookie (3rd option from answer to this question sitecore.stackexchange.com/questions/8211/…) would be best solution for what you are trying to achieve. This has nothing to do with SXA. This is general Sitecore topic Feb 25 '19 at 7:46
1

In SXA you don't need it to set it programmatically. SXA is designed with zero code approach, and almost everything is possible without editing the code.

for DLLm Check the Sitecore.XA.Foundation.Multisite

Before you create a new Website in Tenant, just add the new language you desire, for example Arabic. Go to `/sitecore/system/Languages/' and add the new language

enter image description here

Select Arabic and proceed till completion.

enter image description here

Once added, Go to your tenant, and create a new Site, There you will see the language you just created.

enter image description here

4
  • I know that, I want to know where this process is made pro grammatically, as I need to override this due to my business needs. Feb 24 '19 at 10:56
  • Check the Sitecore.XA.Foundation.Multisite dll Feb 24 '19 at 11:02
  • I thought of it too, I decompiled it but it has many classes, if you know which method please tell me. Feb 24 '19 at 11:05
  • You can set default language in your config <setting name="DefaultLanguage" value="en" /> check this answer, it will help sitecore.stackexchange.com/questions/8211/… Feb 25 '19 at 10:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.