Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface Locale

Hierarchy

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 | null

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

internal_code

internal_code: string

Internal locale code

name

name: string

Locale name

optional

optional: boolean

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

sys

sys: BasicMetaSysProps & { environment: SysLink; space: SysLink }

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.getEnvironment('<environment_id>'))
    .then((environment) => environment.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.getEnvironment('<environment_id>'))
    .then((environment) => environment.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.