Failing to Load Site Settings due to unsupported locale

Overview

The Site Settings can fail to load if the environment if the site is in a localized environment. The specific portal may not support the locale that is selected for the environment.

 

Prerequisites 

 

Diagnosis

The error generated in the SiteRoot/Portals/_default/Logs folder while navigating to the Settings > Site Settings is:

Failed to load resource: the server responded with a status of 400 (Bad Request)
API/PersonaBar/SiteSettings/GetPortalSettings?portalId=undefined&cultureCode=:1 Failed to load resource: the server responded with a status of 400 (Bad Request)

Accessing the network request that was failing and viewing the response in the developer tools by pressing F12 and clicking the network tab, shows:

{"Message": "Current site does not support this locale (en-US)."}

This error is due to the Portal not having the specific Locale/Language. In this case, it appears that the PortalLocalization table has the correct culture code (en-US). However, the PortalLanguages table does not have the respective pair for the Portal ID / Locale.

 

Solution

To resolve this error, follow the steps below:

  1. Locate the Portal ID of one of the sites with this issue. You can find this PortalID by going into Manage > Sites > List View > Site ID.

    2020-06-04_1526.png

  2. Then execute the following queries from the Settings > SQL Console menu in the Persona Bar or using SSMS.

    The query below will list the CultureCode used for the Portal and the Language ID for this CultureCode. Since the error mentions 'en-US', the LanguageID is expected to be '1'. You can confirm the LanguageID by running SELECT * FROM Languages in the SQL Console.

    SELECT PortalID,
    PortalName,
    pl.CultureCode,
    LanguageID
    FROM PortalLocalization pl
    JOIN Languages l ON pl.CultureCode = l.CultureCode
    WHERE PortalID = X --replace the X with the Portal ID
  3. Once the language(s) used by the Portal have been identified, next, we will execute the query below to find out if the language(s) are bound to the Portal.
    SELECT PortalID,
    LanguageID
    FROM PortalLanguages
    WHERE PortalID = X --replace the X with the Portal ID
  4. If the above query does not return an entry matching the PortalID/LanguageID for the Portal with this issue, then the solution would be to insert the missing language manually. We can add the language to the Portal using the below query.

    Note: As a best practice, make sure to create a backup of the database before proceeding.
    EXEC AddPortalLanguage PortalID, LanguageID, 1, 1
  5. The last step is to clear the Application Cache to load the new settings from the database. To clear the cache, go to the Settings > Servers menu and click on the Clear Cache button.

 

Testing

You can test that this issue has been resolved by:

  1. Go into Settings > Site Settings
  2. The Site Settings should now load without any issues.

Comments

0 comments

Please sign in to leave a comment.