Locale

Locale

Source:
Locale instances

Type Definitions

Locale

Source:
Properties:
Name Type Description
sys Meta.Sys System metadata
name string
code string Locale code (example: en-us)
fallbackCode string the locale code to fallback to when there is not content for the current locale
contentDeliveryApi boolean If the content under this locale should be available on the CDA (for public reading)
contentManagementApi boolean If the content under this locale should be available on the CMA (for editing)
default boolean If this is the default locale
optional boolean If the locale needs to be filled in on entries or not
toPlainObject() function Returns this Locale as a plain JS object

Methods

(static) delete() → {Promise}

Source:
Deletes this object on the server.
Example
const contentful = require('contentful-management')

const client = contentful.createClient({
  accessToken: '<content_management_api_key>'
})

client.getSpace('<space_id>')
.then((space) => space.getLocale('<locale_id>'))
.then((locale) => locale.delete())
.then(() => console.log(`locale deleted.`))
.catch(console.error)
Returns:
Promise for the deletion. It contains no data, but the Promise error case should be handled.
Type
Promise

(static) update() → {Promise.<Locale>}

Source:
Sends an update to the server with any changes made to the object's properties
Example
const contentful = require('contentful-management')

const client = contentful.createClient({
  accessToken: '<content_management_api_key>'
})

client.getSpace('<space_id>')
.then((space) => space.getLocale('<locale_id>'))
.then((locale) => {
  locale.name = 'New locale name'
  return locale.update()
})
.then((locale) => console.log(`locale ${locale.sys.id} updated.`))
.catch(console.error)
Returns:
Object returned from the server with updated changes.
Type
Promise.<Locale>