> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://contentful.com/developers/docs/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://contentful.com/_mcp/server. # Update a locale PUT https://api.contentful.com/spaces/{space_id}/environments/{environment_id}/locales/{locale_id} Content-Type: application/vnd.contentful.management.v1+json Updates a locale in a space; include the current version in `X-Contentful-Version`. Changing a locale's `code` affects all future API responses and is not allowed on locales used as fallbacks. Reference: https://contentful.com/developers/docs/references/content-management-api/locales/update-a-locale ## Authentication - `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer `, where token is your auth token. ## Request ### Path parameters - `space_id` (string, required) — ID of the Space in form of a string - `environment_id` (string, required) — ID of the environment in form of a string - `locale_id` (string, required) — ID of the Locale in form of a string ### Headers - `X-Contentful-Version` (string, required) — Version of the locale to update ### Body (application/vnd.contentful.management.v1+json) This endpoint expects a map from string to any. - `map from string to any` ## Response ### 201 Created - Resource created successfully - `map from string to any` ## Examples **Request** ```json { "code": "en-US", "fallbackCode": "en-US", "name": "English (United States)", "optional": false } ``` **Response** ```json { "code": "en-US", "contentDeliveryApi": true, "contentManagementApi": true, "default": false, "fallbackCode": "en-US", "name": "English (United States)", "optional": false, "sys": { "createdAt": "2025-07-13T03:17:24.000Z", "createdBy": { "sys": { "id": "7BslKh9TdKGOK41VmLDjFZ", "linkType": "User", "type": "Link" } }, "environment": { "sys": { "id": "staging", "linkType": "Environment", "type": "Link" } }, "id": "34N35DoyUQAtaKwWTgZs34", "space": { "sys": { "id": "yadj1kx9rmg0", "linkType": "Space", "type": "Link" } }, "type": "Locale", "updatedAt": "2025-07-13T03:17:24.000Z", "updatedBy": { "sys": { "id": "4FLrUHftHW3v2BLi9fzfjU", "linkType": "User", "type": "Link" } }, "version": 1 } } ``` **SDK Code** ```android Android // Create the Contentful client. final CMAClient client = new CMAClient .Builder() .setAccessToken("") .setSpaceId("") .setEnvironmentId("") .build(); client .locales() .async() .fetchOne( "", new CMACallback() { @Override protected void onSuccess(CMALocale locale) { locale.setName("new name is new"); client .locales() .async() .update( locale, new CMACallback() { @Override protected void onSuccess(CMALocale locale) { new AlertDialog.Builder(context) .setTitle("Contentful Error") .setMessage("Updating successful. New locale: " + locale) .show(); } } ); } @Override protected void onFailure(RuntimeException exception) { // An error occurred! Inform the user. new AlertDialog.Builder(context) .setTitle("Contentful Error") .setMessage("Could not find a locale to be deleted." + "\n\nReason: " + exception.toString()) .show(); super.onFailure(exception); } } ); ``` ```java Java // Create the Contentful client. final CMAClient client = new CMAClient .Builder() .setAccessToken("") .setSpaceId("") .setEnvironmentId("") .build(); final CMALocale locale = client .locales() .fetchOne(""); locale.setName(locale.getName() + " and a new name"); client .locales() .update(locale); ``` ```kotlin Kotlin // Create the Contentful client. val client = CMAClient.Builder() .setAccessToken("") .setSpaceId("") .setEnvironmentId("") .build() val locale = client .locales() .fetchOne("") locale.name = locale.name + " and a new name" client .locales() .update(locale) ``` ```swift Swift We currently don't provide a CMA SDK for this platform. ``` ```js-legacy JavaScript (legacy) import { createClient } from 'contentful-management' const client = createClient({ accessToken: '' }, { type: 'legacy' }) client.getSpace('') .then((space) => space.getEnvironment('')) .then((environment) => environment.getLocale('')) .then((locale) => { locale.name = 'New locale name' return locale.update() }) .then((locale) => console.log(`Locale ${locale.sys.id} updated.`)) .catch(console.error) ``` ```javascript JavaScript import { createClient } from 'contentful-management' // Client init const client = contentful.createClient({ accessToken: '' }) let locale = await client.locale.get({ spaceId: '', environmentId: '', localeId: 'en-US', }); locale = await client.locale.update( { spaceId: '', environmentId: '', localeId: 'en-US', }, { ...locale, name: 'English (US)', } ); ``` ```php PHP $client = new \Contentful\Management\Client(''); $environment = $client->getEnvironmentProxy('', ''); $locale = $environment->getLocale(''); $locale->setName('New locale name'); $locale->update(); ``` ```ruby Ruby require 'contentful/management' client = Contentful::Management::Client.new('') locale = client.locales('', '').find('') locale.name = 'Engspan' locale.save ``` ```python Python from contentful_management import Client client = Client('') locale = client.locales('', '').find('') locale.name = 'Not so english' locale.save() ``` ```.net .NET // This client should only be created once per application. var httpClient = new HttpClient(); var client = new ContentfulManagementClient(httpClient, "", ""); var localeToUpdate = await client.GetLocale(""); localeToUpdate.Name = "Updated!"; var locale = await client.UpdateLocale(localeToUpdate); ```