Languages
Multilingual support in Clarifai
The Clarifai API supports many languages in addition to English. These are represented as translations of the names of concepts so that when you search by concept name or get predictions from a model's concepts you can utilize the language of your choice.

Supported Languages

The currently supported languages are listed below.
Language
Code
Arabic (ar)
ar
Bengali (bn)
bn
Danish (da)
da
German (de)
de
English (en)
en
Spanish (es)
es
Finnish (fi)
fi
French (fr)
fr
Hindi (hi)
hi
Hungarian (hu)
hu
Italian (it)
it
Japanese (ja)
ja
Korean (ko)
ko
Dutch (nl)
nl
Norwegian (no)
no
Punjabi (pa)
pa
Polish (pl)
pl
Portuguese (pt)
pt
Russian (ru)
ru
Swedish (sv)
sv
Turkish (tr)
tr
Chinese Simplified (zh)
zh
Chinese Traditional (zh-TW)
zh-TW

Default Language

When you create a new Application, you must specify a default language. This will be the default language concepts are returned in when you do not explicitly set a language in an API request. You cannot change the default language. You can however change languages per request.
create new app

List language translations by concept ID

You can see all the language translations for a given concept ID with a GET call. This call supports pagination.
gRPC Java
gRPC NodeJS
gRPC Python
cURL
Javascript (REST)
1
import com.clarifai.grpc.api.*;
2
import com.clarifai.grpc.api.status.*;
3
4
// Insert here the initialization code as outlined on this page:
5
// https://docs.clarifai.com/api-guide/api-overview/api-clients#client-installation-instructions
6
7
MultiConceptResponse listConceptLanguagesResponse = stub.listConceptLanguages(
8
ListConceptLanguagesRequest.newBuilder()
9
.setConceptId("charlie")
10
.build()
11
);
12
13
if (listConceptLanguagesResponse.getStatus().getCode() != StatusCode.SUCCESS) {
14
throw new RuntimeException("List concept languages failed, status: " + listConceptLanguagesResponse.getStatus());
15
}
Copied!
1
// Insert here the initialization code as outlined on this page:
2
// https://docs.clarifai.com/api-guide/api-overview/api-clients#client-installation-instructions
3
4
stub.ListConceptLanguages(
5
{
6
concept_id: "charlie"
7
},
8
metadata,
9
(err, response) => {
10
if (err) {
11
throw new Error(err);
12
}
13
14
if (response.status.code !== 10000) {
15
throw new Error("List concepts failed, status: " + response.status.description);
16
}
17
}
18
);
Copied!
1
# Insert here the initialization code as outlined on this page:
2
# https://docs.clarifai.com/api-guide/api-overview/api-clients#client-installation-instructions
3
4
list_concept_languages_response = stub.ListConceptLanguages(
5
service_pb2.ListConceptLanguagesRequest(
6
concept_id="charlie"
7
),
8
metadata=metadata
9
)
10
11
if list_concept_languages_response.status.code != status_code_pb2.SUCCESS:
12
print("There was an error with your request!")
13
print("\tCode: {}".format(list_concept_languages_response.outputs[0].status.code))
14
print("\tDescription: {}".format(list_concept_languages_response.outputs[0].status.description))
15
print("\tDetails: {}".format(list_concept_languages_response.outputs[0].status.details))
16
raise Exception("List concept failed, status: " + list_concept_languages_response.status.description)
Copied!
1
curl -X GET \
2
-H "Authorization: Key YOUR_API_KEY" \
3
-H "Content-Type: application/json" \
4
https://api.clarifai.com/v2/concepts/{concept_id}/languages
Copied!
1
const conceptId = '{CONCEPT_ID}'
2
const appId = '{YOUR_APP_ID}'
3
4
const requestOptions = {
5
method: 'GET',
6
headers: {
7
'Accept': 'application/json',
8
'Authorization': 'Key {YOUR_PERSONAL_TOKEN}'
9
}
10
};
11
12
fetch(`https://api.clarifai.com/v2/users/me/apps/${appId}/concepts/${conceptId}/languages`, requestOptions)
13
.then(response => response.text())
14
.then(result => console.log(result))
15
.catch(error => console.log('error', error));
Copied!

Get specific language translation for a concept

To get a single language translation you have for a concept you can get by the language code and concept id.
gRPC Java
gRPC NodeJS
gRPC Python
cURL
Javascript (REST)
1
import com.clarifai.grpc.api.*;
2
import com.clarifai.grpc.api.status.*;
3
4
// Insert here the initialization code as outlined on this page:
5
// https://docs.clarifai.com/api-guide/api-overview/api-clients#client-installation-instructions
6
7
MultiConceptResponse getConceptLanguageResponse = stub.getConceptLanguage(
8
ListConceptLanguageRequest.newBuilder()
9
.setConceptId("charlie")
10
.setLanguage("ja")
11
.build()
12
);
13
14
if (getConceptLanguageResponse.getStatus().getCode() != StatusCode.SUCCESS) {
15
throw new RuntimeException("List concept languages failed, status: " + getConceptLanguageResponse.getStatus());
16
}
Copied!
1
// Insert here the initialization code as outlined on this page:
2
// https://docs.clarifai.com/api-guide/api-overview/api-clients#client-installation-instructions
3
4
stub.GetConceptLanguage(
5
{
6
concept_id: "charlie",
7
language: "ja"
8
},
9
metadata,
10
(err, response) => {
11
if (err) {
12
throw new Error(err);
13
}
14
15
if (response.status.code !== 10000) {
16
throw new Error("Get concepts failed, status: " + response.status.description);
17
}
18
}
19
);
Copied!
1
# Insert here the initialization code as outlined on this page:
2
# https://docs.clarifai.com/api-guide/api-overview/api-clients#client-installation-instructions
3
4
get_concept_language_response = stub.GetConceptLanguage(
5
service_pb2.GetConceptLanguageRequest(
6
concept_id="charlie",
7
language="ja"
8
),
9
metadata=metadata
10
)
11
12
if get_concept_langauge_response.status.code != status_code_pb2.SUCCESS:
13
print("There was an error with your request!")
14
print("\tCode: {}".format(get_concept_language_response.outputs[0].status.code))
15
print("\tDescription: {}".format(get_concept_language_response.outputs[0].status.description))
16
print("\tDetails: {}".format(get_concept_language_response.outputs[0].status.details))
17
raise Exception("Get concept failed, status: " + get_concept_language_response.status.description)
Copied!
1
curl -X GET \
2
-H "Authorization: Key YOUR_API_KEY" \
3
-H "Content-Type: application/json" \
4
https://api.clarifai.com/v2/concepts/{concept_id}/languages/{language}
Copied!
1
const conceptId = '{CONCEPT_ID}'
2
const appId = '{YOUR_APP_ID}'
3
const language = '{LANGUAGE}'
4
5
const requestOptions = {
6
method: 'GET',
7
headers: {
8
'Accept': 'application/json',
9
'Authorization': 'Key {YOUR_PERSONAL_TOKEN}'
10
}
11
};
12
13
fetch(`https://api.clarifai.com/v2/users/me/apps/${appId}/concepts/${conceptId}/languages/${language}`, requestOptions)
14
.then(response => response.text())
15
.then(result => console.log(result))
16
.catch(error => console.log('error', error));
Copied!

Add a language translation for a concept

To create a langauge translation for a concept you can POST that language translation.
gRPC Java
gRPC NodeJS
gRPC Python
cURL
Javascript (REST)
1
import com.clarifai.grpc.api.*;
2
import com.clarifai.grpc.api.status.*;
3
4
// Insert here the initialization code as outlined on this page:
5
// https://docs.clarifai.com/api-guide/api-overview/api-clients#client-installation-instructions
6
7
MultiConceptResponse postConceptLanguageResponse = stub.postConceptLanguage(
8
PostConceptLanguageRequest.newBuilder()
9
.setConceptId("charlie")
10
.addConceptLanguages(ConceptLanguage.newBuilder().setId("ja").setName("ボスコ"))
11
.build()
12
);
13
14
if (postConceptLanguageResponse.getStatus().getCode() != StatusCode.SUCCESS) {
15
throw new RuntimeException("Post concept languages failed, status: " + postConceptLanguageResponse.getStatus());
16
}
Copied!
1
// Insert here the initialization code as outlined on this page:
2
// https://docs.clarifai.com/api-guide/api-overview/api-clients#client-installation-instructions
3
4
stub.PostConceptLanguage(
5
{
6
concept_id: "charlie",
7
concept_languages: [
8
{
9
id: "ja",
10
name: "ボスコ"
11
}
12
]
13
},
14
metadata,
15
(err, response) => {
16
if (err) {
17
throw new Error(err);
18
}
19
20
if (response.status.code !== 10000) {
21
throw new Error("Get concepts failed, status: " + response.status.description);
22
}
23
}
24
);
Copied!
1
# Insert here the initialization code as outlined on this page:
2
# https://docs.clarifai.com/api-guide/api-overview/api-clients#client-installation-instructions
3
4
get_concept_language_response = stub.PostConceptLanguage(
5
service_pb2.PostConceptLanguageRequest(
6
concept_id="charlie",
7
concept_languages=[resources_pb2.ConceptLanguages(
8
id="ja",
9
name="ボスコ"
10
)]
11
),
12
metadata=metadata
13
)
14
15
if get_concept_langauge_response.status.code != status_code_pb2.SUCCESS:
16
print("There was an error with your request!")
17
print("\tCode: {}".format(get_concept_language_response.outputs[0].status.code))
18
print("\tDescription: {}".format(get_concept_language_response.outputs[0].status.description))
19
print("\tDetails: {}".format(get_concept_language_response.outputs[0].status.details))
20
raise Exception("Get concept failed, status: " + get_concept_language_response.status.description)
Copied!
1
curl -X GET \
2
-H "Authorization: Key YOUR_API_KEY" \
3
-H "Content-Type: application/json" \
4
https://api.clarifai.com/v2/concepts/{concept_id}/languages/{language}
Copied!
1
const conceptId = '{YOUR_CONCEPT_ID}'
2
3
const raw = JSON.stringify({
4
"user_app_id": {
5
"user_id": "{YOUR_USER_ID}",
6
"app_id": "{YOUR_APP_ID}"
7
},
8
"concept_languages": [
9
{
10
"id": "ko",
11
"name": "개"
12
}
13
]
14
});
15
16
const requestOptions = {
17
method: 'POST',
18
headers: {
19
'Accept': 'application/json',
20
'Authorization': 'Key {YOUR_PERSONAL_TOKEN}'
21
},
22
body: raw
23
};
24
25
fetch(`https://api.clarifai.com/v2/concepts/${conceptId}/languages`, requestOptions)
26
.then(response => response.text())
27
.then(result => console.log(result))
28
.catch(error => console.log('error', error));
Copied!

Update a language translation for a concept

To update a langauge translation for a concept you can PATCH that language translation.
gRPC Java
gRPC NodeJS
gRPC Python
cURL
Javascript (REST)
1
import com.clarifai.grpc.api.*;
2
import com.clarifai.grpc.api.status.*;
3
4
// Insert here the initialization code as outlined on this page:
5
// https://docs.clarifai.com/api-guide/api-overview/api-clients#client-installation-instructions
6
7
MultiConceptResponse patchConceptLanguageResponse = stub.patchConceptLanguage(
8
PatchConceptLanguageRequest.newBuilder()
9
.setAction("overwrite")
10
.setConceptId("charlie")
11
.addConceptLanguages(ConceptLanguage.newBuilder().setId("ja").setName("new name"))
12
.build()
13
);
14
15
if (patchConceptLanguageResponse.getStatus().getCode() != StatusCode.SUCCESS) {
16
throw new RuntimeException("Patch concept languages failed, status: " + patchConceptLanguageResponse.getStatus());
17
}
Copied!
1
// Insert here the initialization code as outlined on this page:
2
// https://docs.clarifai.com/api-guide/api-overview/api-clients#client-installation-instructions
3
4
stub.PatchConceptLanguage(
5
{
6
action: "overwrite",
7
concept_id: "charlie",
8
concept_languages: [
9
{
10
id: "ja",
11
name: "new name"
12
}
13
]
14
},
15
metadata,
16
(err, response) => {
17
if (err) {
18
throw new Error(err);
19
}
20
21
if (response.status.code !== 10000) {
22
throw new Error("Get concepts failed, status: " + response.status.description);
23
}
24
}
25
);
Copied!
1
# Insert here the initialization code as outlined on this page:
2
# https://docs.clarifai.com/api-guide/api-overview/api-clients#client-installation-instructions
3
4
get_concept_language_response = stub.PatchConceptLanguage(
5
service_pb2.PatchConceptLanguageRequest(
6
concept_id="charlie",
7
concept_languages=[resources_pb2.ConceptLanguages(
8
id="ja",
9
name="new name"
10
)],
11
action="overwrite"
12
),
13
metadata=metadata
14
)
15
16
if get_concept_langauge_response.status.code != status_code_pb2.SUCCESS:
17
print("There was an error with your request!")
18
print("\tCode: {}".format(get_concept_language_response.outputs[0].status.code))
19
print("\tDescription: {}".format(get_concept_language_response.outputs[0].status.description))
20
print("\tDetails: {}".format(get_concept_language_response.outputs[0].status.details))
21
raise Exception("Get concept failed, status: " + get_concept_language_response.status.description)
Copied!
1
curl -X GET \
2
-H "Authorization: Key YOUR_API_KEY" \
3
-H "Content-Type: application/json" \
4
https://api.clarifai.com/v2/concepts/{concept_id}/languages/{language}
Copied!
1
const conceptId = '{YOUR_CONCEPT_ID}'
2
3
const raw = JSON.stringify({
4
"user_app_id": {
5
"user_id": "{YOUR_USER_ID}",
6
"app_id": "{YOUR_APP_ID}"
7
},
8
"concept_languages": [
9
{
10
"id": "ko",
11
"name": "개"
12
}
13
],
14
"action": "overwrite"
15
});
16
17
var requestOptions = {
18
method: 'PATCH',
19
headers: {
20
'Accept': 'application/json',
21
'Authorization': 'Key {YOUR_PERSONAL_TOKEN}'
22
},
23
body: raw
24
};
25
26
fetch(`https://api.clarifai.com/v2/concepts/${conceptId}/languages`, requestOptions)
27
.then(response => response.text())
28
.then(result => console.log(result))
29
.catch(error => console.log('error', error));
Copied!
Last modified 1mo ago