Comfortable | Docs
  • Comfortable Documentation
  • Concepts
    • Content Repositories
    • Content Types
    • Documents
    • Assets
    • Content Tree
    • Collections
    • Webhooks
    • Team
    • Locales
  • APIs
    • RESTful API
      • Endpoints
      • API Reference
        • Sorting
        • Filters
        • Localisation
        • Fields
        • Includes
        • Search
      • Query Examples
        • Collections
        • Single Documents
        • Single Assets
        • Sorting
        • Filters
        • Includes
    • Image Manipulation
  • SDKs
    • JavaScript
      • Query Options
      • Query All Documents
      • Query a Collection
      • Query a Single Document
      • Query an Alias
      • Query an Asset
      • Example: Filters
      • Example: Sorting
    • Nuxt.js
    • PHP
      • Query All Documents
      • Query Single Document
      • Query Collection
      • Query an Alias
      • Query an Asset
      • Fulltext Search
      • Query by Fields
      • Query by Type
      • Query by Id
      • Query by Tags
  • Guides
    • Vue Blog Example
  • Legal
    • Legal Notice
    • Privacy Policy
Powered by GitBook
On this page
  • Set localisation for query results
  • Examples
  1. APIs
  2. RESTful API
  3. API Reference

Localisation

Localisation is controlled by the locale parameter. If no parameter is given, the response includes only the default language of the repository.

Possible values for locale are <languageKey> or all

Value

Function

<languageKey>, e.g. en_US

Returns the field values for the specified locale, or their fallback (if configured).

all

Returns all available locales as field value, prefixed by their language key. (See the response in the query example below).

Set localisation for query results

GET https://api.cmft.io/v1/<repoName>/<endpoint>?locale=<languageKey>

Path Parameters

Name
Type
Description

repoName

string

The API identifier of the repository

endpoint

string

The endpoint you'd like to request

locale

string

Provide the language Key, e.g. en_US or all

// Response with a specific language key or the default language
{
  "fields": {
    "title": "Roses are red"
  },
  "meta": {
    "id": "314159265358979323",
    "contentType": "poem",
    "repository": "314159265358979323",
    "revision": 1,
    "tags": [],
    "createdAt": "2018-01-01T00:00:00.000Z",
    "updatedAt": "2018-01-01T00:00:00.000Z"
  }
}

// Response with locale="all"
{
  "fields": {
    "title": {
      "en_US": "Roses are red",
      "de_DE": "Rosen sind rot"
    }
  },
  "meta": {
    "id": "314159265358979323",
    "contentType": "poem",
    "repository": "314159265358979323",
    "revision": 1,
    "tags": [],
    "createdAt": "2018-01-01T00:00:00.000Z",
    "updatedAt": "2018-01-01T00:00:00.000Z"
  }
}

Examples

Find some example on the collections example page:

PreviousFiltersNextFields

Last updated 6 years ago

Collections