Multi-Language Support
Developers are able to utilize the feature of multi-language in certain endpoints, as shown in the table of Applicable Locations, to assure that the content is fit to the language set in a store.
That said, it is achievable by setting header values, such as ACCEPT-LANGUAGE
and CONTENT-LANGUAGE
. Let's dive into each one of the header values settings.
Accept Language
Accept-Language, a request HTTP header, advertises which languages the merchant is able to understand, and which locale variant is preferred.
Set Language Code you want to get the response with. Use the iso_code
value you get from the Language Endpoint as a value in this header.
By default, Accept-Language header is set to the Arabic language, with an iso_code
of ar
.
Content Language (Optional)
Content-Language, an entity header, is used to describe the language(s) intended for the audience, allowing the developer to differentiate based on the merchant's preferred language.
Checkout the Languages Endpoint for more on the ISO Codes.
:::info
🧵 TL;DR
The best way to think of this is that Content-Language
describes content and Accept-Language
conveys a preference.
:::
Usage
The following cURL request example gets Product Details in the English and Arabic languages and returns a corresponding payload. Note that the header request is appending the ACCEPT-LANGUAGE
to the specified language.
cURL Request Sample
curl --location --request GET 'https://api.salla.dev/admin/v2/products/720881993' \
--header 'ACCEPT-LANGUAGE: en' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer YOUR_ACCESS_TOKEN'
Response Sample
{
"status": 200,
"success": true,
"data": {
"id": 720881993,
"promotion": {
"title": "Order now",
"sub_title": "veggie pizza"
},
"sku": "54534534",
"mpn": null,
"gtin": null,
"type": "food",
"name": "Pizza",
"short_link_code": "zlrrRr",
"urls": {
"customer": "https://salla.sa/dev-wofftr4xsra5xtlv/pizza/p720881993",
"admin": "https://s.salla.sa/products/720881993"
},
"price": {
"amount": 51.75,
"currency": "SAR"
},
"taxed_price": {
"amount": 51.75,
"currency": "SAR"
},
"pre_tax_price": {
"amount": 45,
"currency": "SAR"
},
"tax": {
"amount": 6.75,
"currency": "SAR"
},
"description": "<p><br></p>",
"quantity": null,
"status": "sale",
"is_available": true,
"views": 0,
"sale_price": {
"amount": 51.75,
"currency": "SAR"
},
"sale_end": "2022-05-26",
"require_shipping": true,
"cost_price": "15.00",
"weight": 0.25,
"with_tax": true,
"url": "https://salla.sa/dev-wofftr4xsra5xtlv/pizza/p720881993",
"main_image": "https://cdn.salla.sa/bYQEn/buItWZf4OLbaTmL7vTMlDUWLOn20hfpq3QUbD2AB.jpg",
"images": [
{
"id": 1592532977,
"url": "https://cdn.salla.sa/bYQEn/fruYYNomFLINttfdlKPAz7WYG50z0j5zPzzy2MjS.jpg",
"main": true,
"three_d_image_url": "",
"alt": "",
"video_url": "",
"type": "image",
"sort": 0
}
],
"sold_quantity": "1",
"rating": {
"total": 0,
"count": 1,
"rate": 0
},
"regular_price": {
"amount": 51.75,
"currency": "SAR"
},
"max_items_per_user": 2,
"maximum_quantity_per_order": 2,
"show_in_app": true,
"notify_quantity": null,
"hide_quantity": false,
"unlimited_quantity": true,
"managed_by_branches": false,
"calories": "600.00",
"metadata": {
"title": null,
"description": null
},
"allow_attachments": false,
"is_pinned": false,
"pinned_date": "2022-05-24 15:40:23",
"sort": 0,
"enable_upload_image": true,
"updated_at": "2022-05-26 09:45:09",
"options": [
{
"id": 1674915438,
"name": "الاضافات",
"description": "",
"type": "checkbox",
"required": true,
"associated_with_order_time": 0,
"availability_range": false,
"not_same_day_order": false,
"choose_date_time": null,
"from_date_time": null,
"to_date_time": null,
"sort": 0,
"advance": false,
"display_type": null,
"visibility": "always",
"translations": {
"ar": {
"option_name": "الاضافات",
"description": ""
}
},
"values": [
{
"id": 152115913,
"name": "بصل",
"price": {
"amount": 0,
"currency": "SAR"
},
"display_value": null,
"advance": false,
"option_id": 1674915438,
"image_url": null,
"hashed_display_value": null,
"translations": {
"ar": {
"option_details_name": "بصل"
}
}
},
{
"id": 1526610378,
"name": "فلفل",
"price": {
"amount": 0,
"currency": "SAR"
},
"display_value": null,
"advance": false,
"option_id": 1674915438,
"image_url": null,
"hashed_display_value": null,
"translations": {
"ar": {
"option_details_name": "فلفل"
}
}
},
{
"id": 886790347,
"name": "زيتون",
"price": {
"amount": 0,
"currency": "SAR"
},
"display_value": null,
"advance": false,
"option_id": 1674915438,
"image_url": null,
"hashed_display_value": null,
"translations": {
"ar": {
"option_details_name": "زيتون"
}
}
}
]
}
],
"skus": [],
"categories": [
{
"id": 399447873,
"name": "Italian",
"urls": {
"customer": "https://salla.sa/dev-wofftr4xsra5xtlv/italian/c399447873",
"admin": "https://s.salla.sa/categories"
},
"items": [
{
"id": 1887256138,
"name": "Pizza",
"urls": {
"customer": "https://salla.sa/dev-wofftr4xsra5xtlv/pizza/c1887256138",
"admin": "https://s.salla.sa/categories"
},
"items": [],
"parent_id": 399447873,
"status": "active",
"sort_order": 0
}
],
"parent_id": 298280307,
"status": "active",
"sort_order": 0
}
],
"brand": {
"id": 146591953,
"name": "Pizza time",
"description": "Pizza store since 1955",
"banner": null,
"logo": "https://cdn.salla.sa/bYQEn/LeeG0bRRnUvjaz31JQtWSwZNRsLiJUigt9LK0riW.jpg",
"ar_char": "ب",
"en_char": "B"
},
"tags": [
{
"id": 1285143056,
"name": "أكل"
},
{
"id": 1924963095,
"name": "طعام"
}
]
}
}
cURL Request Sample
curl --location --request GET 'https://api.salla.dev/admin/v2/products/720881993' \
--header 'ACCEPT-LANGUAGE: ar' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer YOUR_ACCESS_TOKEN'
### Response Sample ```json
{
"status": 200,
"success": true,
"data": {
"id": 720881993,
"promotion": {
"title": "اطلبها ساخنه",
"sub_title": "بيتزا خضار مشكل"
},
"sku": "54534534",
"mpn": null,
"gtin": null,
"type": "food",
"name": "بيتزا",
"short_link_code": "zlrrRr",
"urls": {
"customer": "https://salla.sa/dev-wofftr4xsra5xtlv/بيتزا/p720881993",
"admin": "https://s.salla.sa/products/720881993"
},
"price": {
"amount": 51.75,
"currency": "SAR"
},
"taxed_price": {
"amount": 51.75,
"currency": "SAR"
},
"pre_tax_price": {
"amount": 45,
"currency": "SAR"
},
"tax": {
"amount": 6.75,
"currency": "SAR"
},
"description": "
<strong style="color: rgb(189, 193, 198); background-color: rgb(32, 33, 36);">Pizza<span style="color: rgb(189, 193, 198); background-color: rgb(32, 33, 36);">) هي أكلة تعود أصولها إلى دول شرق البحر الأبيض المتوسط كاليونان وتركيا حيث كانوا يقومون بإنضاج طبقة من العجين على حجر ساخن ويغطونها بأنواع المكونات المختلفة مثل اللحم والخضروات.
","quantity": null,
"status": "sale",
"is_available": true,
"views": 0,
"sale_price": {
"amount": 51.75,
"currency": "SAR"
},
"sale_end": "2022-05-26",
"require_shipping": true,
"cost_price": "15.00",
"weight": 0.25,
"with_tax": true,
"url": "https://salla.sa/dev-wofftr4xsra5xtlv/بيتزا/p720881993",
"main_image": "https://cdn.salla.sa/bYQEn/buItWZf4OLbaTmL7vTMlDUWLOn20hfpq3QUbD2AB.jpg",
"images": [
{
"id": 1592532977,
"url": "https://cdn.salla.sa/bYQEn/fruYYNomFLINttfdlKPAz7WYG50z0j5zPzzy2MjS.jpg",
"main": true,
"three_d_image_url": "",
"alt": "",
"video_url": "",
"type": "image",
"sort": 0
}
],
"sold_quantity": "1",
"rating": {
"total": 0,
"count": 1,
"rate": 0
},
"regular_price": {
"amount": 51.75,
"currency": "SAR"
},
"max_items_per_user": 2,
"maximum_quantity_per_order": 2,
"show_in_app": true,
"notify_quantity": null,
"hide_quantity": false,
"unlimited_quantity": true,
"managed_by_branches": false,
"calories": "600.00",
"metadata": {
"title": null,
"description": null
},
"allow_attachments": false,
"is_pinned": false,
"pinned_date": "2022-05-24 15:40:23",
"sort": 0,
"enable_upload_image": true,
"updated_at": "2022-05-26 09:45:09",
"options": [
{
"id": 1674915438,
"name": "الاضافات",
"description": "",
"type": "checkbox",
"required": true,
"associated_with_order_time": 0,
"availability_range": false,
"not_same_day_order": false,
"choose_date_time": null,
"from_date_time": null,
"to_date_time": null,
"sort": 0,
"advance": false,
"display_type": null,
"visibility": "always",
"translations": {
"ar": {
"option_name": "الاضافات",
"description": ""
}
},
"values": [
{
"id": 152115913,
"name": "بصل",
"price": {
"amount": 0,
"currency": "SAR"
},
"display_value": null,
"advance": false,
"option_id": 1674915438,
"image_url": null,
"hashed_display_value": null,
"translations": {
"ar": {
"option_details_name": "بصل"
}
}
},
{
"id": 1526610378,
"name": "فلفل",
"price": {
"amount": 0,
"currency": "SAR"
},
"display_value": null,
"advance": false,
"option_id": 1674915438,
"image_url": null,
"hashed_display_value": null,
"translations": {
"ar": {
"option_details_name": "فلفل"
}
}
},
{
"id": 886790347,
"name": "زيتون",
"price": {
"amount": 0,
"currency": "SAR"
},
"display_value": null,
"advance": false,
"option_id": 1674915438,
"image_url": null,
"hashed_display_value": null,
"translations": {
"ar": {
"option_details_name": "زيتون"
}
}
}
]
}
],
"skus": [],
"categories": [
{
"id": 399447873,
"name": "ايطالي",
"urls": {
"customer": "https://salla.sa/dev-wofftr4xsra5xtlv/ايطالي/c399447873",
"admin": "https://s.salla.sa/categories"
},
"items": [
{
"id": 1887256138,
"name": "بيتزا",
"urls": {
"customer": "https://salla.sa/dev-wofftr4xsra5xtlv/بيتزا/c1887256138",
"admin": "https://s.salla.sa/categories"
},
"items": [],
"parent_id": 399447873,
"status": "active",
"sort_order": 0
}
],
"parent_id": 298280307,
"status": "active",
"sort_order": 0
}
],
"brand": {
"id": 146591953,
"name": "بيتزا تايم",
"description": "مخبز بيتزا من 1955",
"banner": null,
"logo": "https://cdn.salla.sa/bYQEn/LeeG0bRRnUvjaz31JQtWSwZNRsLiJUigt9LK0riW.jpg",
"ar_char": "ب",
"en_char": "B"
},
"tags": [
{
"id": 1285143056,
"name": "أكل"
},
{
"id": 1924963095,
"name": "طعام"
}
]
}
}
```
Applicable Variables
The following section showcases the endpoints with their respective available translation variables that developers may use to demonstrate multi-language support.
Create Product Endpoint
Variable Title |
---|
metdata.title |
metdata.description |
metdata.url |
List Products Endpoint
Variable Title |
---|
name |
promotion.title |
promotion.subtitle |
metdata.title |
metdata.description |
metdata.url |
description |
categories.name |
Product Details Endpoint
Variable Title |
---|
name |
promotion.title |
promotion.subtitle |
metdata.title |
metdata.description |
metdata.url |
description |
categories.name |
Update Product Endpoint
Variable Title |
---|
metdata_title |
metdata_description |
metdata_url |
Variable Title |
---|
name |
promotion.title |
promotion.subtitle |
metdata.title |
metdata.description |
metdata.url |
description |
Product Details by SKU Endpoint
Variable Title |
---|
metdata.title |
metdata.description |
metdata.url |
Update Product by SKU Endpoint
Variable Title |
---|
metdata_title |
metdata_description |
metdata_url |
Variable Title |
---|
metdata.title |
metdata.description |
metdata.url |
Create Custom Sub-Status
Variable Title |
---|
name |
message |
List Order Statuses
Variable Title |
---|
name |
Order Status Details
Variable Title |
---|
name |
message |
Update Statuses
Variable Title |
---|
name |
message |
List Branches Endpoint
Variable Title |
---|
name |
address_description |
street |
local |
Branch Details Endpoint
Variable Title |
---|
name |
address_description |
street |
local |
Update Branch Endpoint
Variable Title |
---|
name |
address_description |
street |
local |
List Categories Endpoint
Variable Title |
---|
name |
items.name |
Category Details Endpoint
Variable Title |
---|
name |
items.name |
Update Category Endpoint
Variable Title |
---|
name |
List Brands
Variable Title |
---|
name |
description |
metadata.title |
metadata.description |
metadata.url |
Brand Details Endpoint
Variable Title |
---|
name |
description |
metadata.title |
metadata.description |
metadata.url |
Update Brand Endpoint
Variable Title |
---|
name |
description |
metadata.title |
metadata.description |
metadata.url |
List Special Offers
Variable Title |
---|
name |
message |
Special Offer Details
Variable Title |
---|
name |
message |
Update Special Offer
Variable Title |
---|
name |
List Advertisments Endpoint
Variable Title |
---|
description |
Advertisement Details Endpoint
Variable Title |
---|
description |
Update Advertisement Endpoint
Variable Title |
---|
description |
List SEO Settings Endpoint
Variable Title |
---|
title |
keywords |
description |
Update SEO Settings Endpoint
Variable Title |
---|
title |
keywords |
description |