OCS Translation API

The OCS Translation API allows you to translate strings from a language to another.

The base URL for all calls to the Translation API is: <nextcloud_base_url>/ocs/v2.php/translation/

All calls to OCS endpoints require the OCS-APIRequest header to be set to true.

Get available translation options

field

type

Description

languageDetection

bool

Whether "from" language can be skipped as a translation provider supports detecting it from input

languages

array

A list of language tuples, see definition below

Language tuple structure

field

type

Description

from

string

ISO code of the "from" language

fromLabel

string

Name of the "from" language that should be shown to the user

to

string

ISO code of the "to" language

toLabel

string

Name of the "to" language that should be shown to the user

Translate a string

field

type

Description

text

string

The text to be translated

fromLanguage

string/null

The ISO code of the "from" language, when null is given and a translation provider allows detecting the source language it will be tried to guess it from the text input

toLanguage

string

The ISO code of the "to" language