Ways to get localized content
Is this page helpful?
English
, en-US
, or en-GB
.
es-ES
for Spanish.en-US
and the second language set as Spanish es-ES
, which falls back to the default language.
language=es-ES
– Specifies the codename of the requested language.system.language=es-ES
– Filters content items by their language.language parameter value | system.language parameter value | Behavior |
es-ES | <not set> | The API returns content items in Spanish. If an item is not translated to Spanish, the API returns the English (en-us ) version of the items as fallback. |
es-ES | es-ES | The API returns only content items in Spanish. If an item is not translated to Spanish, the API doesn't return it. |
es-ES | en-US | The API returns only content items in English provided they don't have content in Spanish. If an item is translated to Spanish, it is not returned. |
// Tip: Find more about PHP SDKs at https://kontent.ai/learn/php
// Defined by Composer to include required libraries
require __DIR__ . '/vendor/autoload.php';
use Kontent\Ai\Delivery\DeliveryClient;
$client = new DeliveryClient('8d20758c-d74c-4f59-ae04-ee928c0816b7');
$items = $client->getItem('about_us', (new QueryParams())
->language('es-ES'));
// Tip: Find more about PHP SDKs at https://kontent.ai/learn/php
// Defined by Composer to include required libraries
require __DIR__ . '/vendor/autoload.php';
use Kontent\Ai\Delivery\DeliveryClient;
$client = new DeliveryClient('8d20758c-d74c-4f59-ae04-ee928c0816b7');
$items = $client->getItems((new QueryParams())
->language('es-ES')
->equals('system.type', 'article')
->equals('elements.url_pattern', 'acerda-de-nosotros'));
// Tip: Find more about PHP SDKs at https://kontent.ai/learn/php
// Defined by Composer to include required libraries
require __DIR__ . '/vendor/autoload.php';
use Kontent\Ai\Delivery\DeliveryClient;
$client = new DeliveryClient('975bf280-fd91-488c-994c-2f04416e5ee3');
$items = $client->getItems((new QueryParams())
->language('es-ES')
->equals('system.language', 'es-ES'));