Contentful logo

Contentful Community

How to change locale in nuxt.js sdk

Hi there,

I am building an E-commerce PWA using Vue Store Front. I am using nuxt.js sdk of contetnful for fetching the data.

I am using below code for creating contenful client -

export default async function (ctx) {

  const contentful = require('contentful')

  const config = {

    space: '*********',

    accessToken: '********************************',

    environment: '*********'

  }

  ctx.$CfClient = contentful.createClient(config);

}

And for fetching entries I am using below code snippet-

`async nuxtServerInit({ commit }, context) {
        await context.$CfClient.getEntries({
            'content_type': '******',
            'include': 4,
        }).then((entries) => {}).catch(function (error) {});
}`

I am having two locale in contentful as below -

I want to fetch data of German “de” local. What changes should I do in my code ?