2023-02-07 02:14:07 +01:00
|
|
|
---
|
|
|
|
title: Translation
|
|
|
|
description: Represents the result of machine translating some status content
|
|
|
|
menu:
|
|
|
|
docs:
|
|
|
|
parent: entities
|
|
|
|
aliases: [
|
|
|
|
"/api/entities/Translation",
|
|
|
|
"/api/entities/translation",
|
|
|
|
]
|
|
|
|
---
|
|
|
|
|
2023-12-10 19:44:53 +01:00
|
|
|
## Examples
|
|
|
|
|
|
|
|
Translation of status with content warning and media
|
2023-02-07 02:14:07 +01:00
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
2023-12-10 19:44:53 +01:00
|
|
|
"content": "<p>Hello world</p>",
|
|
|
|
"spoiler_text": "Greatings ahead",
|
|
|
|
"media_attachments": [
|
|
|
|
{
|
2024-04-02 13:12:15 +02:00
|
|
|
"id": "22345792",
|
2023-12-10 19:44:53 +01:00
|
|
|
"description": "Status author waving at the camera"
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"poll": null,
|
|
|
|
"detected_source_language": "es",
|
2023-02-07 02:14:07 +01:00
|
|
|
"provider": "DeepL.com"
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2023-12-10 19:44:53 +01:00
|
|
|
Translation of status with poll:
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"content": "<p>Should I stay or should I go?</p>",
|
|
|
|
"spoiler_text": "",
|
|
|
|
"media_attachments": [],
|
2024-04-02 13:12:15 +02:00
|
|
|
"poll": {
|
|
|
|
"id": "34858",
|
|
|
|
"options": [
|
|
|
|
{
|
|
|
|
"title": "Stay"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"title": "Go"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
2023-12-10 19:44:53 +01:00
|
|
|
"detected_source_language": "ja",
|
|
|
|
"provider": "DeepL.com"
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
|
2023-02-07 02:14:07 +01:00
|
|
|
## Attributes
|
|
|
|
|
|
|
|
### `content` {#content}
|
|
|
|
|
2023-12-10 19:44:53 +01:00
|
|
|
**Description:** HTML-encoded translated content of the status.\
|
2023-02-07 02:14:07 +01:00
|
|
|
**Type:** String (HTML)\
|
|
|
|
**Version history:**\
|
|
|
|
4.0.0 - added
|
|
|
|
|
2024-04-02 13:12:15 +02:00
|
|
|
### `spoiler_text` {#spoiler_text}
|
2023-12-10 19:44:53 +01:00
|
|
|
|
|
|
|
**Description:** The translated spoiler warning of the status.\
|
|
|
|
**Type:** String\
|
|
|
|
**Version history:**\
|
|
|
|
4.2.0 - added
|
|
|
|
|
2024-04-02 13:12:15 +02:00
|
|
|
### `poll` {{%optional%}} {#poll}
|
2023-12-10 19:44:53 +01:00
|
|
|
|
2024-04-02 13:12:15 +02:00
|
|
|
**Description:** The translated poll of the status.\
|
|
|
|
**Type:** [Translation::Poll](#Poll)\
|
2023-12-10 19:44:53 +01:00
|
|
|
**Version history:**\
|
|
|
|
4.2.0 - added
|
|
|
|
|
|
|
|
### `media_attachments` {#media_attachments}
|
|
|
|
|
|
|
|
**Description:** The translated media descriptions of the status.\
|
2024-04-02 13:12:15 +02:00
|
|
|
**Type:** Array of [Translation::Attachment](#Attachment)\
|
2023-12-10 19:44:53 +01:00
|
|
|
**Version history:**\
|
|
|
|
4.2.0 - added
|
|
|
|
|
2023-02-07 02:14:07 +01:00
|
|
|
### `detected_source_language` {#detected_source_language}
|
|
|
|
|
|
|
|
**Description:** The language of the source text, as auto-detected by the machine translation provider.\
|
|
|
|
**Type:** String (ISO 639 language code)\
|
|
|
|
**Version history:**\
|
|
|
|
4.0.0 - added
|
|
|
|
|
|
|
|
### `provider` {#provider}
|
|
|
|
|
|
|
|
**Description:** The service that provided the machine translation.
|
|
|
|
**Type:** String\
|
|
|
|
**Version history:**\
|
|
|
|
4.0.0 - added
|
|
|
|
|
2024-04-02 13:12:15 +02:00
|
|
|
## Translation::Poll attributes {#Poll}
|
|
|
|
|
|
|
|
### `id` {#Poll-id}
|
|
|
|
|
|
|
|
**Description:** The ID of the poll.\
|
|
|
|
**Type:** String (cast from an integer, but not guaranteed to be a number)\
|
|
|
|
**Version history:**\
|
|
|
|
4.2.0 - added
|
|
|
|
|
|
|
|
### `options` {#Poll-options}
|
|
|
|
|
|
|
|
**Description:** The translated poll options.\
|
|
|
|
**Type:** Array of [Translation::Poll::Option](#Option)\
|
|
|
|
**Version history:**\
|
|
|
|
4.2.0 - added
|
|
|
|
|
|
|
|
## Translation::Poll::Option attributes {#Option}
|
|
|
|
|
|
|
|
### `title` {#Option-title}
|
|
|
|
|
|
|
|
**Description:** The translated title of the poll option.\
|
|
|
|
**Type:** String\
|
|
|
|
**Version history:**\
|
|
|
|
4.2.0 - added
|
|
|
|
|
|
|
|
## Translation::Attachment attributes {#Attachment}
|
|
|
|
|
|
|
|
### `id` {#Attachment-id}
|
|
|
|
|
|
|
|
**Description:** The id of the attachment.\
|
|
|
|
**Type:** String (cast from an integer, but not guaranteed to be a number)\
|
|
|
|
**Version history:**\
|
|
|
|
4.2.0 - added
|
|
|
|
|
|
|
|
### `description` {#Attachment-description}
|
|
|
|
|
|
|
|
**Description:** The translated description of the attachment.\
|
|
|
|
**Type:** String\
|
|
|
|
**Version history:**\
|
|
|
|
4.2.0 - added
|
|
|
|
|
2023-02-07 02:14:07 +01:00
|
|
|
## See also
|
|
|
|
|
|
|
|
{{< page-relref ref="methods/statuses#translate" caption="POST /api/v1/statuses/:id/translate" >}}
|
|
|
|
|
2024-04-02 13:12:15 +02:00
|
|
|
{{< caption-link url="https://github.com/mastodon/mastodon/blob/main/app/serializers/rest/translation_serializer.rb" caption="app/serializers/rest/translation_serializer.rb" >}}
|