# Localization

## Why localization matters

Localization allows your FAQ content to be accessible to users in their native language, improving clarity, trust, and overall user experience. It ensures that your knowledge base can serve a diverse audience without duplicating structures for each language.

Supporting multiple languages also helps:

* Reduce support requests caused by language barriers
* Help international users have a better experience
* Keep all content in one place with versions for each language

## How to use localization in API

By default, each FAQ is created with a base localization when the community is set up.

### Retrieving content in different languages

There are two ways to get FAQ content in a specific language:

* Using the `SbLanguage` header with a value from the supported [`Language`](https://developers.socialboards.com/docs/apis/faq/reference/enumerations/localization-language) enumeration
* Using the standard `Accept-Language` HTTP header with values based on **LCID** (Locale Identifier). These values follow the [RFC 5646](https://datatracker.ietf.org/doc/html/rfc5646) format, which is widely supported in browsers and HTTP clients. Only the first specified language will be used during request processing; others will be ignored.

If no language is provided, the system uses the default language of the FAQ.

If a language is specified:

* If localized content is available, it is returned.
* If not, the base language content is returned.

### Response

The response will include a `Content-Language` header that shows which language was used to return the resource. This value also follows the [RFC 5646](https://datatracker.ietf.org/doc/html/rfc5646) format. It also includes a `Content-SbLanguage` header with a value from the [`Language`](https://developers.socialboards.com/docs/apis/faq/reference/enumerations/localization-language) enumeration.

#### Examples

**Request example using `SbLanguage` header**

```http
GET /faq/instances
Host: api.socialboards.com
Authorization: Bearer eyJhbGciOiJIUzUxMiIs
SbLanguage: norwegian
```

**Response**

```json
{
    "data": [
        {
            "availableLanguages": [
                "norwegian",
                "english",
                "swedish",
                "finnish"
            ],
            "bigLogoLink": "",
            "creationTime": "2023-08-18T08:42:42.2522564+00:00",
            "currentLanguage": "english",
            "customCss": "",
            "customerWebsiteLink": "https://mywebsite.com",
            "defaultFormLink": "",
            "displayName": "publicapitests",
            "facebookLink": "",
            "faviconLink": null,
            "footerContent": "<br>",
            "formLink": "",
            "googleAnalyticsCode": null,
            "googleTagManagerCode": null,
            "headerSubTitle": "Subtitle",
            "headerTitle": "Title",
            "instagramLink": "",
            "isAccessByPasswordEnabled": false,
            "isChatEnabled": false,
            "isCookieMessageHidden": true,
            "isDefault": true,
            "isFooterHidden": true,
            "logoLink": "",
            "name": "publicapitests",
            "stickyButtonColor1": "#f5f5f5",
            "stickyButtonColor2": "#f5f5f5",
            "stickyButtonColor3": "#f5f5f5",
            "stickyButtonTextColor1": "#231f1f",
            "stickyButtonTextColor2": "#231f1f",
            "stickyButtonTextColor3": "#231f1f",
            "templateType": "text_default",
            "twitterLink": ""
        }
    ],
    "errorCode": -1,
    "errorText": null
}
```

**Response headers**

```
Headers
Content-Language: no
Content-SbLanguage: norwegian
```

**Example using `Accept-Language` header**

```http
GET /faq/instances
Host: api.socialboards.com
Authorization: Bearer eyJhbGciOiJIUzUxMiIs
Accept-Language: no
```

**Response**

```json
{
    "data": [
        {
            "availableLanguages": [
                "norwegian",
                "english",
                "swedish",
                "finnish"
            ],
            "bigLogoLink": "",
            "creationTime": "2023-08-18T08:42:42.2522564+00:00",
            "currentLanguage": "english",
            "customCss": "",
            "customerWebsiteLink": "https://mywebsite.com",
            "defaultFormLink": "",
            "displayName": "publicapitests",
            "facebookLink": "",
            "faviconLink": null,
            "footerContent": "<br>",
            "formLink": "",
            "googleAnalyticsCode": null,
            "googleTagManagerCode": null,
            "headerSubTitle": "Subtitle",
            "headerTitle": "Title",
            "instagramLink": "",
            "isAccessByPasswordEnabled": false,
            "isChatEnabled": false,
            "isCookieMessageHidden": true,
            "isDefault": true,
            "isFooterHidden": true,
            "logoLink": "",
            "name": "publicapitests",
            "stickyButtonColor1": "#f5f5f5",
            "stickyButtonColor2": "#f5f5f5",
            "stickyButtonColor3": "#f5f5f5",
            "stickyButtonTextColor1": "#231f1f",
            "stickyButtonTextColor2": "#231f1f",
            "stickyButtonTextColor3": "#231f1f",
            "templateType": "text_default",
            "twitterLink": ""
        }
    ],
    "errorCode": -1,
    "errorText": null
}
```

**Response headers**

```
Headers
Content-Language: no
Content-SbLanguage: norwegian
```
