Reading Translations in Different Languages
Products, classes, characteristics, characteristic groups, and characteristic values are translated. The specific name of a language, sometimes also called short description, is provided and used in most UIs. The specific description of a language, sometimes called long description or documentation, might also be added. The description can contain multiple lines and some basic formatting like line breaks.
It is recommended to cache or persist the translations as it is cumbersome to call GET /api/v1/knowledgeBases/{kbId} several times, that is, once for each language.
Translations are efficiently called with the translation endpoint /api/v1/knowledgeBases/{kbId}/translations.
The endpoint offers a filter for languages like $filter=language IN (‘en’,’de’,’fr’).
The endpoint also offers a projection to limit the returned entities. Currently, the projection allows to select one of the three top level entities. If there is no selection, no entity projection is applied: $select=products,classes,characteristics.
It offers another query parameter effectivityDate. This is used to determine the externalized text elements. When set, only the externalized text records, that are effective for that given date will be used.
Example:
GET /api/v1/knowledgeBases/2/translations?$select=products&$filter=language IN (de) Authorization: Bearer eyJhb... Accept: */* Cache-Control: no-cache Host: ssc-engine.c-9d83367... Accept-Encoding: gzip, deflate, br Connection: keep-alive Cookie: JSESSIONID=2BF9B92B99ADBFED40BC9C63318C663F; lbhash="b105eaa660b14b24"
The response has a potentially large body containing the names and the descriptions:
HTTP/1.1 200 OK
cache-control: no-cache, no-store, max-age=0, must-revalidate
content-encoding: gzip
content-security-policy: default-src 'self'
content-type: application/json
correlation_id: 109986f0-ede7-4c48-ae75-c1d6287ac004
date: Fri, 28 Apr 2023 12:52:41 GMT
expires: 0
pragma: no-cache
sap-server: true
server: istio-envoy
set-cookie: JSESSIONID=9FBF0C31A93A9A97FA1BE99FFECC56FE; Path=/; Secure; HttpOnly
strict-transport-security: max-age=31536000 ; includeSubDomains
x-content-type-options: nosniff
x-correlationid: 109986f0-ede7-4c48-ae75-c1d6287ac004
{"productTranslations":[{"id":"PPO_RACK_03","translations":[{"language":"en","name":"Rack 03 (PPO)"}]},...}
Translations include language, name, and description. If there is no name, the name is omitted, if there is no description for a given language, the description is omitted, if there is no name and no description, the complete translation is omitted. Not providing empty or null names and descriptions lowers the amount of data. On the other hand, the recipient needs to interpret the absence of the parameter correctly. No name/description is maintained in the underlying ERP or S4 system.