Localization
Responses are localized server-side based on the following rules listed by order of priority:
- User Profile
- IP Address
- Platform Settings
Context
The I18NContext
containing the perceived client's information that will be used to localize responses is provided by platform.i18n
.
query I18NContext {
platform {
i18n {
country {
isoCode
}
language {
isoCode
}
currency {
isoCode
}
}
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
{
"data": {
"platform": {
"i18n": {
"country": {
"isoCode": "FR"
},
"language": {
"isoCode": "FR"
},
"currency": {
"isoCode": "EUR"
}
}
}
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
If needed, you can also get the client geolocation (which is not influenced by the user profile settings) from platform.access.country
:
query ClientGeolocation {
platform {
access {
country
}
}
}
1
2
3
4
5
6
7
{
"data": {
"platform": {
"access": {
"country": "FR"
}
}
}
}
1
2
3
4
5
6
7
8
9
Content Filtering
Most cms
models (Category
, Product
, ...) can have their visibility or possible actions (such as purchase) restricted based on the user's country location (platform.access.country
). This is configurable from the back office model's editor and is automatically applied by filtering API responses.
Text
I18NString
are texts localized in responses, regular String
are not.
query GetCategories {
cms {
categories {
items {
id
name
}
}
}
}
1
2
3
4
5
6
7
8
9
10
{
"data": {
"cms": {
"categories": {
"items": [
{
"id": "2",
"name": "Home"
},
]
}
}
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
{
"data": {
"cms": {
"categories": {
"items": [
{
"id": "2",
"name": "Accueil"
},
]
}
}
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Price
Prices are converted from the default platform currency to the user country currency and we also provide formatted price strings that you can display.
query Products {
cms {
products (includeIds: [1]) {
items {
id
name
extension {
... on ProductTVOD {
accessModes {
id
type
price
priceFormat
}
}
}
}
}
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
{
"data": {
"cms": {
"products": {
"items": [
{
"id": "1",
"name": "The line",
"extension": {
"accessModes": [
{
"id": "64",
"type": "SUBSCRIPTION",
"price": null,
"priceFormat": null
},
{
"id": "2",
"type": "RENT",
"price": 3.5,
"priceFormat": "€3.50"
},
{
"id": "3",
"type": "RENT",
"price": 4.333333,
"priceFormat": "€4.33"
},
{
"id": "1",
"type": "RENT",
"price": 6,
"priceFormat": "€6.00"
}
]
}
}
]
}
}
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
{
"data": {
"cms": {
"products": {
"items": [
{
"id": "1",
"name": "The line",
"extension": {
"accessModes": [
{
"id": "64",
"type": "SUBSCRIPTION",
"price": null,
"priceFormat": null
},
{
"id": "2",
"type": "RENT",
"price": 3.8337774999999996,
"priceFormat": "$3.83"
},
{
"id": "3",
"type": "RENT",
"price": 4.746581301545,
"priceFormat": "$4.75"
},
{
"id": "1",
"type": "RENT",
"price": 6.572189999999999,
"priceFormat": "$6.57"
}
]
}
}
]
}
}
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42