Doku durchsuchen
Menü
Geändert am Auf GitHub bearbeiten

Konsole: languages

Als Markdown kopieren

Diese Routen liegen auf der Konsole, Port 3375. Sie nehmen ein API-Token als Authorization: Bearer ndt_...; siehe API-Tokens. Die Beschreibungen stehen auf Englisch, wie in der OpenAPI-Beschreibung.

The console's languages and translations.

GET /api/i18n/languages

List the languages the console speaks.

Answers everyone, signed in or not.

neodesk languages available calls it.

200: Done (application/json)

Field Type Required What it is
success true yes
data object yes The languages keyed by code, in the order they were loaded
list array of ConsoleLanguage yes The same languages sorted by their native name

POST /api/i18n/set/{code}

Choose the console language of your account.

Sets the language cookie and, when signed in, stores the choice on your account. Takes no body.

neodesk languages choose calls it.

Parameter In Type Required What it is
code path string yes The language code, like de or pt-BR

200: Done (application/json)

ConsoleSuccess.

Error When
400 The console has no such language
401 No session or API token, or one that is not valid (code session_required or token_invalid)
403 The account or the token may not do this, or a write from a browser came without a good CSRF token

GET /api/i18n/translations/{code}

Show every text of a language.

Answers everyone, signed in or not. The texts are nested objects keyed by section, with English filling the keys the language lacks.

neodesk languages strings calls it.

Parameter In Type Required What it is
code path string yes The language code, like de or pt-BR

200: Done (application/json)

Field Type Required What it is
success true yes
data object yes The texts, nested by section
Error When
400 The language code is not valid
404 The console has no such language

POST /api/i18n/upload

Upload a language file (give it as --data @xx.json).

Takes a multipart form with one JSON file of at most 1 MB in the field file. The language code comes from the file's _meta.code, else the form's code field, else the file name without .json, and must be a language the console knows. The file replaces the language's file and the language is loaded again. On installs where the languages ship with the server, uploads answer 400.

Needs server.config. neodesk languages upload calls it.

Request body, multipart/form-data:

Field Type Required What it is
file string (binary) yes The language file, JSON
code string The language code, used when the file has no _meta.code

200: Done (application/json)

Field Type Required
success true yes
data object yes
data.code string yes
data.meta ConsoleLanguage or null yes
Error When
400 No file, a file that is not JSON, an unknown language code, or languages that ship with the server
401 No session or API token, or one that is not valid (code session_required or token_invalid)
403 The account or the token may not do this, or a write from a browser came without a good CSRF token
413 The file or a form field is over 1 MB, or the form has too many parts

GET /api/i18n/validate/{code}

Check a language file against English.

Compares the language's keys with English. A language the console has not loaded still answers 200, with valid false and the error "Language not found". English answers valid true with empty lists.

neodesk languages validate calls it.

Parameter In Type Required What it is
code path string yes The language code, like de or pt-BR

200: Done (application/json)

Field Type Required What it is
success true yes
data object yes
data.valid boolean yes True when no English key is missing
data.missing array of string English keys the language lacks
data.extra array of string Keys only the language has, without those starting with _
data.coverage string The share of English keys the language has, in percent with one decimal, like 98.7
data.error string Language not found, when the console has not loaded the language
Error When
401 No session or API token, or one that is not valid (code session_required or token_invalid)
403 The account or the token may not do this, or a write from a browser came without a good CSRF token

DELETE /api/i18n/{code}

Delete an uploaded language.

Removes the language's file and stops offering the language. English and Polish can't be deleted, nor languages that ship with the server.

Needs server.config. neodesk languages delete calls it. It cannot be undone.

Parameter In Type Required What it is
code path string yes The language code, like de or pt-BR

200: Done (application/json)

ConsoleSuccess.

Error When
400 An invalid code, English or Polish, or languages that ship with the server
401 No session or API token, or one that is not valid (code session_required or token_invalid)
403 The account or the token may not do this, or a write from a browser came without a good CSRF token
404 The console has no such language

GET /api/panel/languages

List the languages with how complete each is.

Reads every language file and counts its keys against the keys of English and Polish together. English and Polish are the reference languages: their missing_keys is always 0. A file that can't be read gets a row with its error.

Needs server.config. neodesk languages list calls it.

200: Done (application/json)

Field Type Required What it is
languages array of object yes
languages[].code string yes
languages[].name string yes
languages[].native string yes
languages[].flag string yes
languages[].rtl boolean yes
languages[].needs_review boolean yes Set in the file's _meta
languages[].is_reference boolean yes True for English and Polish
languages[].total_keys integer yes Keys in the file
languages[].missing_keys integer yes Reference keys the file lacks
languages[].extra_keys integer yes Keys only the file has
languages[].empty_keys integer yes Reference keys the file has with an empty text
languages[].coverage integer yes Percent of the reference keys the file has, rounded
languages[].error string or null yes Why the file could not be read, null when it could
refKeyCount integer yes The number of reference keys
Error When
401 No session or API token, or one that is not valid (code session_required or token_invalid)
403 The account or the token may not do this, or a write from a browser came without a good CSRF token
429 Too many requests: wait for the seconds in Retry-After

POST /api/panel/languages/{code}/fix

Add the missing keys of a language from English (turned off: always answers 410).

Filling missing keys is turned off on this server: the route always answers 410 and changes nothing. Translate the missing keys in the language file and upload it instead.

Needs server.config. neodesk languages fix calls it.

Parameter In Type Required What it is
code path string yes The language code, like de or pt-BR
Error When
401 No session or API token, or one that is not valid (code session_required or token_invalid)
403 The account or the token may not do this, or a write from a browser came without a good CSRF token
410 Automatic language fixing is disabled
429 Too many requests: wait for the seconds in Retry-After
default Never answered: the route always answers 410 to a signed-in account with server.config

GET /api/panel/languages/{code}/missing

List the keys a language lacks.

Answers the reference keys (English and Polish) the language file lacks, with their English and Polish texts, and the keys only the file has. Not wrapped in success and data.

Needs server.config. neodesk languages missing calls it.

Parameter In Type Required What it is
code path string yes The language code, like de or pt-BR

200: Done (application/json)

Field Type Required What it is
code string yes
missing array of object yes
missing[].key string yes
missing[].en_value string yes
missing[].pl_value string yes
extra array of string yes
total integer yes The number of reference keys
Error When
400 The language code is not valid
401 No session or API token, or one that is not valid (code session_required or token_invalid)
403 The account or the token may not do this, or a write from a browser came without a good CSRF token
404 There is no file for the language
429 Too many requests: wait for the seconds in Retry-After

Durchsucht Seiten, Abschnitte, Befehle und Einstellungen.