Internationalization: Page and Queries
Page and Translations​
A Page
that you get from the query hooks (usePagesPublic
, usePagePublic
) or the fetch helper functions (fetchPages
, fetchPage
) has a translations
field with an array of available translations for that page.
Each translation has a language
('en', 'it', ...) and a slug
(the slug for the page in that language).
Page​
type Page = {
...
translations: Translation[]
}
Translation​
type Translation = {
language: string
slug: string
}
Queries​
usePagesPublic​
The usePagesPublic
hook has a language
argument to return the published pages in the desired language.
See usePagePublic
fetchPages​
The fetchPages
helper function has the ability to specify a language
in the options
object.
See fetchPages
usePagePublic​
The usePagePublic
hook has arguments slug
and language
, so that you can specify the translation that you want to receive for that page, if more than one have the same slug.
See usePagePublic
fetchPage​
The fetchPage
helper function has arguments slug
, apiKey
, language
, so that you can specify the translation that you want to receive for that page, if more than one have the same slug.
See fetchPage