Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface Locale

Hierarchy

  • { code: string; contentDeliveryApi: boolean; contentManagementApi: boolean; default: boolean; fallbackCode: string; name: string; optional: boolean; sys: MetaSysProps }
  • DefaultElements<LocaleProps>
    • Locale

Index

Properties

code

code: string

Locale code (example: en-us)

contentDeliveryApi

contentDeliveryApi: boolean

If the content under this locale should be available on the CDA (for public reading)

contentManagementApi

contentManagementApi: boolean

If the content under this locale should be available on the CMA (for editing)

default

default: boolean

If this is the default locale

fallbackCode

fallbackCode: string

Locale code to fallback to when there is not content for the current locale

name

name: string

Locale name

optional

optional: boolean

If the locale needs to be filled in on entries or not

sys

Methods

delete

  • delete(): Promise<void>
  • 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<void>

    Promise for the deletion. It contains no data, but the Promise error case should be handled.

toPlainObject

update

  • 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 Promise<Locale>

    Object returned from the server with updated changes.