31
loading...
This website collects cookies to deliver better user experience
yarn strapi install i18n
or
npm run strapi install i18n
yarn create strapi-app my-project --quickstart
or
npx create-strapi-app my-project --quickstart
locale
API parameter, we can fetch data belonging to a particular locale. You should pass the locale code along with the call as a parameter. The request should be a GET
request. With that said, let's try making a call to the endpoint using Postman.localhost:1337/posts?_locale=fr-FR
. The /post
is the endpoint to fetch post from our Post collection. We added a prefix of _locale
which specifies that we want to fetch contents from a particular locale. fr-FR
is specifying that we want to fetch Post from the French locale. localhost:1337/posts?_locale=fr-FR
. The /Post
is the endpoint to fetch Post from our Post collection. We added _ locale
, which specifies that we want to fetch contents from a particular locale. fr-FR
is determining that we want to fetch Post from the French Locale. {
"statusCode": 403,
"error": "Forbidden",
"message": "Forbidden"
}
locale
parameter that will point to the new Locale we intend to create. {
"name": "She's Cake",
"description": "She's Cake restaurant description in French",
"locale": "fr"
}
locale
parameter, the request would create the Post in the default locale
. The code below does not contain a locale parameter. This script will create this Post in English, which is the default locale in our case.{
"name": "Oplato",
"description": "Oplato restaurant description in English"
}
Posts
endpoint.localhost:1337/posts
31