* broken migration * fixed migration * created new endpoints for translation strings * updated to use core endpoint * bad attempts at making the endpoints sensible * merge changes * implemented translation strings service * re-integrating app logic part 1 * re-integrating app logic part 2 * fixed bad lodash import * re-integrating app logic part 3 * removed obsolete tests * make the linter happy * Create tender-trees-buy.md * added option to search-input * implementing search * fixed resizing and sidebar * Fix linting * Remove unused translations update into project settings * Fix missing translations * Require read permissions for app access * Fetch translation strings only when authenticated * Fix project default language not used when user has default language * Remove commented line * Rename variable as content has been changed * Make the current user check more specific * Remove translation_string from Settings type * Remove settings reference in docs * Update changeset * Rename migration file to ensure date order * Rename collection, route, service, controller * Rename migration * Adjust collection in settings route * Fix translations service * Use new `shouldClearCache` util * Drop translation_strings column in migration Co-authored-by: ian <licitdev@gmail.com> * Added basic api docs * updated dictionary * updated dictionary * Update app/src/interfaces/_system/system-input-translated-string/input-translated-string.vue Co-authored-by: Nicola Krumschmidt <nicola.krumschmidt@freenet.de> * Update app/src/modules/settings/routes/translation-strings/collection.vue Co-authored-by: Nicola Krumschmidt <nicola.krumschmidt@freenet.de> * extracted getCurrentLanguage utility * Use regular collections/items * Use regular controller * Fix item view * Set correct system field config for translations * Tweaks * Use UUID * Finish placeholders * Use drawer-item * Add create to the store * Remove composables * Add new placeholder * Fix saving behavior * Remove previous take * Rename migration after merge of live preview * Generate uuid when migrating * Remove unused showFilter * Fix linting * Fix type warnings * Not needed as settings no longer contain translation_strings * Remove leftover blank line * Update getCurrentLanguage with server default and use in hydrate * Shift getCurrentLanguage to lang folder to be alongside setLanguage * add elipsis to placeholder * Remove slug from key, so you can use dots etc in the key * updated translation value to be type text again * Rehydrate fields for updated translation values * Add tooltip * updated documentation * enforce key/language uniqueness in the TranslationService * updated error message * updated docs menu item to "custom translations" * Dynamically fetch translation keys for input-translated-string interface * use get current language in refresh * Update docs/reference/system/translations.md * Update docs/reference/system/translations.md * Update .changeset/tender-trees-buy.md * Fetch translation keys when new key is created * Update api/src/services/translations.ts * Remove translation_strings remnant Co-authored-by: Pascal Jufer <pascal-jufer@bluewin.ch> * mark key, language and value as required * correctly mark fields as required * Catch duplicate key error when creating from input * Translate translations :-) * Update tender-trees-buy.md --------- Co-authored-by: ian <licitdev@gmail.com> Co-authored-by: Pascal Jufer <pascal-jufer@bluewin.ch> Co-authored-by: Nicola Krumschmidt <nicola.krumschmidt@freenet.de> Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
4.1 KiB
description, readTime, pageClass
| description | readTime | pageClass |
|---|---|---|
| REST documentation on the Translations collection in Directus. | 3 min read | page-reference |
Custom Translations
The Translations Object
id uuid
Primary key of the translations
key string
The translation key.
language string
The language of the translation.
value string
The translation value.
{
"data": {
"id": "c4346aa4-81a8-4885-b3a8-f647e4f6f769",
"key": "Test",
"language": "en-US",
"value": "Test"
}
}
List Translations
List all translations that exist in Directus.
Query Parameters
Supports all global query parameters.
Returns
An array of up to limit translation objects. If no items are available, data will be an empty array.
REST API
GET /translations
SEARCH /translations
Retrieve a Translation
List an existing translation by primary key.
Query Parameters
Supports all global query parameters.
Returns
Returns the requested translation object.
REST API
GET /translations/:id
Example
GET /translations/2fc325fb-299b-4d20-a9e7-a34349dee8b2
Create a Translation
Create a new translation.
Query Parameters
Supports all global query parameters.
Request Body
A partial translation object.
Returns
Returns the translation object for the created translation.
REST API
POST /translations
Example
// POST /translations
{
"key": "Test",
"language": "en-US",
"value": "My Test",
}
Create Multiple Translations
Create multiple new translation.
Query Parameters
Supports all global query parameters.
Request Body
An array of partial translation object.
Returns
Returns the translation object for the created translation.
REST API
POST /translations
Example
// POST /translations
[
{
"key": "translation.key",
"language": "en-US",
"value": "My Translation"
},
{
"key": "translation.key",
"language": "en-GB",
"value": "Another Translation"
}
]
Update a Translation
Update an existing translation.
Query Parameters
Supports all global query parameters.
Request Body
A partial translation object.
Returns
Returns the translation object for the updated translation.
REST API
PATCH /translations/:id
Example
// PATCH /translations/2fc325fb-299b-4d20-a9e7-a34349dee8b2
{
"value": "My Updated Translations"
}
Update Multiple Translations
Update multiple existing translations.
Query Parameters
Supports all global query parameters.
Request Body
keys Required
Array of primary keys of the translations you'd like to update.
data Required
Any of translation object's properties.
Returns
Returns the translation objects for the updated translations.
REST API
PATCH /translations
Example
// PATCH /translations
{
"keys": ["3f2facab-7f05-4ee8-a7a3-d8b9c634a1fc", "7259bfa8-3786-45c6-8c08-cc688e7ba229"],
"data": {
"value": "Test Value"
}
}
Delete a Translation
Delete an existing translation.
Returns
Empty body.
REST API
DELETE /translations/:id
Example
DELETE /translations/12204ee2-2c82-4d9a-b044-2f4842a11dba
Delete Multiple Translations
Delete multiple existing translations.
Request Body
An array of translations primary keys
Returns
Empty body.
REST API
DELETE /translations
Example
// DELETE /translations
["25821236-8c2a-4f89-8fdc-c7d01f35877d", "02b9486e-4273-4fd5-b94b-e18fd923d1ed", "7d62f1e9-a83f-407b-84f8-1c184f014501"]