Internationalization
If your collection uses languages other than English, you will need to model your data and queries differently to account for multiple languages.
Things to do
- Ensure your account has the desired languages enabled. Please contact your project partner to validate this.
- Specify the language within the upload configuration
- Specify the language at query time for search and navigation
- For SAYT: specify the language per record in a field, and define the field in the SAYT config
Language in the upload configuration
You can define what language is a given field in, by using the languages
attribute as part the fieldDefinition
.
One or more languages can be defined on a field. If no languages are defined, lang_en
is used by default.
See the Language Reference for a list of available languages.
You should define any languages that are not English as it will improve recall and relevancy for searches in that language.
Sample definition of a field in 2 languages:
fieldDefinition: {name: "field_name", languages: ["lang_en", "lang_fr"]}
Sample definition of a field in one language:
fieldDefinition: {name: "field_name", languages: "lang_zh-CN"}
Language in the query
If you have defined a language at upload time, you will need to specify the language at query time. If you do not specify a language, english (“lang_en”) will be considered the default. An unrecognized language will result in an error.
JSON Reference:
{ "language": "lang_fr" }
SAYT upload configuration
Within the SAYT upload configuration file, you have the optional parameter of languageField
This parameter should contain the name of the field that defines the language of a given record. If you define a languageField
, you must define the language at SAYT query time.
Within your defined searchField
definitions, the first 20 CJK characters will be indexed.
Configuration file::
languageField: productLanguage
Snippet of a record::
{ "id":"1", "title":"my title", "productLanguage": "lang_fr" }
SAYT Query configuration
If you specified a languageField
, then at query time you need to add a language
parameter.
Sample syntax::
{ "language": "lang_fr" }
Available Languages
The following table shows the corresponding language code for each of the supported languages.
Language Code | Language |
---|---|
lang_ar |
Arabic |
lang_zh-CN |
Chinese (Simplified) |
lang_cs |
Czech |
lang_da |
Danish |
lang_nl |
Dutch |
lang_en |
English |
lang_et |
Estonian |
lang_fi |
Finnish |
lang_fr |
French |
lang_de |
German |
lang_el |
Greek |
lang_iw |
Hebrew |
lang_hu |
Hungarian |
lang_is |
Icelandic |
lang_it |
Italian |
lang_ja |
Japanese |
lang_ko |
Korean |
lang_lv |
Latvian |
lang_lt |
Lithuanian |
lang_no |
Norwegian |
lang_pt |
Portuguese |
lang_pl |
Polish |
lang_ro |
Romanian |
lang_ru |
Russian |
lang_es |
Spanish |
lang_sv |
Swedish |
lang_tr |
Turkish |