Documentation

API

Locale API

Add and delete target locales on a project with the WebTranslateIt Locale API, with curl, JavaScript, Python, Ruby and PHP examples. 3 min read

The Locale API is composed of 2 endpoints:

  • Add Locale — add a new locale or language to a project
  • Delete Locale — delete a locale or language from a project

Add Locale

This endpoint is only accessible by the read-write Project API key and is used to add a locale to a project.

/api/projects/:project_token/locales [POST]

Parameters:

  • id: the locale code (en-US, en_GB or fr for instance).
  • suffix_code: Optional, the suffix code (pirate or dev for instance). This will let you create a custome locale (en-pirate or en-dev for intance).
  • suffix_description: Optional, the description of the suffix (pirate or developers for instance).
  • parent_locale_code: Optional, ISO code of the parent locale for language inheritance (only works if the organization plan supports language inheritance).

If everything goes well, the server should respond with 202 Accepted in the response headers. Please note that the request could be acted upon since the rest of the process (creating language files for that locale) is processed in the background on WebTranslateIt’s server. Besides, these new files might not immediately be available.

The parameters are sent as a form body, not as JSON.

POST/api/projects/:project_token/locales
curl -X POST "https://webtranslateit.com/api/projects/PROJECT_TOKEN/locales" \
  -d "id=fr"

Delete Locale

This endpoint is only accessible by the read-write Project API key and is used to delete a locale from a project.

/api/projects/:project_token/locales/:locale_code [DELETE]

If everything goes well, the server should respond with 202 Accepted in the response headers. Please note that the request could be acted upon since the rest of the process (deleting locale, linguistic files and translations for that locale) is processed in the background on WebTranslateIt’s server.

DELETE/api/projects/:project_token/locales/:locale_code
curl -X DELETE "https://webtranslateit.com/api/projects/PROJECT_TOKEN/locales/fr"