documentation icon indicating copy to clipboard operation
documentation copied to clipboard

https://docs.joinmastodon.org/entities/Translation/ is incomplete

Open nikclayton opened this issue 2 years ago • 2 comments

https://docs.joinmastodon.org/entities/Translation/ describes the following attributes in the response.

  • content
  • detected_source_language
  • provider

According to implementation on mastodon.social at the time of writing (4.1.3+nightly-20230706) there is also:

  • spoiler_text
  • language (appears to be the language the text is translated into)
  • poll (untested, but I assume this is a https://docs.joinmastodon.org/entities/Poll/ with options[.title] values translated)

nikclayton avatar Jul 06 '23 22:07 nikclayton

Note re poll -- it doesn't contain the full poll metadata, only the titles and the poll ID.

This is a translated poll where the original post had no content warning.

{
    "detected_source_language": "fr",
    "language": "en",
    "provider": "DeepL.com",
    "spoiler_text": "",
    "content": "<p><span class=\"h-card\"><a href=\"https://mastodon.social/@nikclayton\" class=\"u-url mention\" rel=\"nofollow noopener noreferrer\" target=\"_blank\">@<span>nikclayton</span></a></span></p>",
    "poll": {
        "id": "649249",
        "options": [
            {
                "title": "A"
            },
            {
                "title": "Two"
            },
            {
                "title": "Three"
            },
            {
                "title": "Four"
            }
        ]
    },
    "media_attachments": []
}

This is a translated status with a content warning, body text, and one image with a media description:

{
    "detected_source_language": "fr",
    "language": "en",
    "provider": "DeepL.com",
    "spoiler_text": "A test warning",
    "content": "<p>A test station</p><p><span class=\"h-card\"><a href=\"https://mastodon.social/@nikclayton\" class=\"u-url mention\" rel=\"nofollow noopener noreferrer\" target=\"_blank\">@<span>nikclayton</span></a></span></p>",
    "poll": null,
    "media_attachments": [
        {
            "id": "111325487027294122",
            "description": "A description of the test image"
        }
    ]
}

nikclayton avatar Oct 30 '23 19:10 nikclayton

The doc for Translation does list a spoiler_warning attribute which is not returned as far as I can tell. I believe that is supposed to be spoiler_text.

technicat avatar Jan 31 '24 01:01 technicat