Hierarchy

Properties

code: string

Locale code (example: en-us)

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

fallbackCode: null | string

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

internal_code: string

Internal locale code

name: string

Locale name

optional: boolean

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

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

Methods

  • Deletes this object on the server.

    Returns

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

    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>

  • Sends an update to the server with any changes made to the object's properties

    Returns

    Object returned from the server with updated changes.

    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>