Supporting multilingual applications in JSS
JSS allows you to take advantage of the content language versioning feature of SitecoreAI.
There are typically two factors with rendering translated data from SitecoreAI:
-
The primary page content.
-
Dictionary items used for translation of labels, button text, and so on.
The sample apps demonstrate one approach for making your app fully translatable using the tools provided by JSS.
Rendering translated page content
When getting content from SitecoreAI, the request is made behind the scenes to the SitecoreAI layout service.
The layout service respects the SitecoreAI language context when retrieving route and context data. When using GraphQL, the language is passed explicitly via the language parameter in the query, allowing you to fetch content in the desired language.
You can choose how you invoke the Layout Service and handle language changes.
If you set up your JSS project using a sample application, your app is already configured to handle the fetching of layout data.
Acquiring dictionary phrases
JSS provides a Dictionary API to help you acquire translated phrases in a JSS app.
If you set up your JSS project using a sample application, your app is already configured to handle the fetching of dictionary phrases.
Language routing
JSS does not dictate your route and URL structure. JSS sample applications implement basic routing that follows the SitecoreAI route item hierarchy by default.
If your use cases require it, you can modify the default routing system, but remember that it's much simpler for SitecoreAI content authors to edit the content for the application when the URL structure for the JSS application follows the same route item structure as SitecoreAI.
JSS sample apps demonstrate routing using language prefixes and can handle route formats such as /about, /en/about , or /es-US/about.