JSS Dictionary API

Current version: 19.x

Often, multilingual apps need a dictionary of static phrases that require translation. Commonly, these are items such as form labels, global navigation items, footers, and so on.

Sitecore JavaScript Rendering SDK (JSS) provides an API to help you fetch application-specific translation dictionaries using the Sitecore Dictionary Service.

When using JSS, you can get dictionary data from several endpoints, without worrying about data fetching implementation details. The JSS Dictionary API abstracts data fetching implementation details into services, clients, and data fetchers for REST and GraphQL endpoints. See some usage examples.

After the dictionary data is available in the front-end application, you can choose how to utilize it and what internationalization libraries you prefer. For example, the React JSS application utilizes the i18next module with a custom plugin.

Sitecore endpoints for dictionary data

There are several options for fetching dictionary phrases from Sitecore:

  • Call the REST Dictionary Service endpoint provided by Sitecore Headless Services. The Sitecore Dictionary Service endpoint is a REST endpoint providing app-specific dictionary data.

  • Query the Sitecore Edge Preview GraphQL endpoint provided by Headless Services. Sitecore Edge Preview GraphQL API is an implementation of a GraphQL server on top of Sitecore. The Sitecore GraphQL schema mirrors the Experience Edge schema.

  • Query the GraphQL endpoint provided by Sitecore Experience Edge for XM. Sitecore Experience Edge for XM comes with a read-only GraphQL schema that is designed to accommodate common front-end use cases for headless Sitecore development. Read about the Experience Edge schema.

  • Query the Sitecore GraphQL Endpoint, the first-ever GraphQL endpoint introduced by JSS Server Components. This endpoint is currently only used by React, Angular, and Vue sample applications versions 18.0.0 and earlier.

You can choose whether you want to use REST or GraphQL endpoints when creating your JSS application with the parameter --fetchWith REST or --fetchWith GraphQL.

Do you have some feedback for us?

If you have suggestions for improving this article,