Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 6 additions & 38 deletions Tekst-API/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -9968,54 +9968,22 @@
"sourceLanguage": {
"anyOf": [
{
"$ref": "#/components/schemas/DeepLSourceLanguage"
"type": "null"
},
{
"type": "null"
"type": "string",
"maxLength": 16,
"minLength": 1
}
],
"description": "Source language"
"title": "Sourcelanguage",
"description": "DeepL source language code"
}
},
"type": "object",
"title": "DeepLLinksConfig",
"description": "Resource configuration model for DeepL translation links.\nThe corresponding field MUST be named `deepl_links`!"
},
"DeepLSourceLanguage": {
"type": "string",
"enum": [
"ar",
"bg",
"cs",
"da",
"de",
"el",
"en",
"es",
"et",
"fi",
"fr",
"hu",
"id",
"it",
"ja",
"ko",
"lt",
"lv",
"nb",
"nl",
"pl",
"pt",
"ro",
"ru",
"sk",
"sl",
"sv",
"tr",
"uk",
"zh"
]
},
"DeleteLocationResult": {
"properties": {
"contents": {
Expand Down
45 changes: 8 additions & 37 deletions Tekst-API/tekst/resources/plain_text.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from pathlib import Path
from typing import Annotated, Any, Literal

from pydantic import Field
from pydantic import AfterValidator, Field

from tekst.models.common import ModelBase
from tekst.models.content import ContentBase
Expand All @@ -19,6 +19,7 @@
from tekst.resources import ResourceSearchQuery, ResourceTypeABC
from tekst.types import (
ConStr,
ConStrOrNone,
ContentCssProperties,
SchemaOptionalNullable,
SearchReplacements,
Expand Down Expand Up @@ -186,40 +187,6 @@ class LineLabellingConfig(ModelBase):
] = "numbersOneBased"


type DeepLSourceLanguage = Literal[
"ar",
"bg",
"cs",
"da",
"de",
"el",
"en",
"es",
"et",
"fi",
"fr",
"hu",
"id",
"it",
"ja",
"ko",
"lt",
"lv",
"nb",
"nl",
"pl",
"pt",
"ro",
"ru",
"sk",
"sl",
"sv",
"tr",
"uk",
"zh",
]


class DeepLLinksConfig(ModelBase):
"""
Resource configuration model for DeepL translation links.
Expand All @@ -233,10 +200,14 @@ class DeepLLinksConfig(ModelBase):
),
] = False
source_language: Annotated[
DeepLSourceLanguage | None,
ConStrOrNone(
max_length=16,
cleanup="oneline",
),
Field(
description="Source language",
description="DeepL source language code",
),
AfterValidator(lambda x: x.lower() if x else None),
] = None


Expand Down
172 changes: 172 additions & 0 deletions Tekst-Web/src/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,72 +162,244 @@ export const resourceTypes = [
];

export const deeplSourceLanguages = [
'ace',
'af',
'an',
'ar',
'as',
'ay',
'az',
'ba',
'be',
'bg',
'bho',
'bn',
'br',
'bs',
'ca',
'ceb',
'ckb',
'cs',
'cy',
'da',
'de',
'el',
'en',
'eo',
'es',
'et',
'eu',
'fa',
'fi',
'fr',
'ga',
'gl',
'gn',
'gom',
'gu',
'ha',
'he',
'hi',
'hr',
'ht',
'hu',
'hy',
'id',
'ig',
'is',
'it',
'ja',
'jv',
'ka',
'kk',
'kmr',
'ko',
'ky',
'la',
'lb',
'lmo',
'ln',
'lt',
'lv',
'mai',
'mg',
'mi',
'mk',
'ml',
'mn',
'mr',
'ms',
'mt',
'my',
'nb',
'ne',
'nl',
'oc',
'om',
'pa',
'pag',
'pam',
'pl',
'prs',
'ps',
'pt',
'qu',
'ro',
'ru',
'sa',
'scn',
'sk',
'sl',
'sq',
'sr',
'st',
'su',
'sv',
'sw',
'ta',
'te',
'tg',
'th',
'tk',
'tl',
'tn',
'tr',
'ts',
'tt',
'uk',
'ur',
'uz',
'vi',
'wo',
'xh',
'yi',
'yue',
'zh',
'zu',
];

export const deeplTargetLanguages = [
'ace',
'af',
'an',
'ar',
'as',
'ay',
'az',
'ba',
'be',
'bg',
'bho',
'bn',
'br',
'bs',
'ca',
'ceb',
'ckb',
'cs',
'cy',
'da',
'de',
'el',
'en',
'en-gb',
'en-us',
'eo',
'es',
'es-419',
'et',
'eu',
'fa',
'fi',
'fr',
'ga',
'gl',
'gn',
'gom',
'gu',
'ha',
'he',
'hi',
'hr',
'ht',
'hu',
'hy',
'id',
'ig',
'is',
'it',
'ja',
'jv',
'ka',
'kk',
'kmr',
'ko',
'ky',
'la',
'lb',
'lmo',
'ln',
'lt',
'lv',
'mai',
'mg',
'mi',
'mk',
'ml',
'mn',
'mr',
'ms',
'mt',
'my',
'nb',
'ne',
'nl',
'oc',
'om',
'pa',
'pag',
'pam',
'pl',
'prs',
'ps',
'pt',
'pt-br',
'pt-pt',
'qu',
'ro',
'ru',
'sa',
'scn',
'sk',
'sl',
'sq',
'sr',
'st',
'su',
'sv',
'sw',
'ta',
'te',
'tg',
'th',
'tk',
'tl',
'tn',
'tr',
'ts',
'tt',
'uk',
'ur',
'uz',
'vi',
'wo',
'xh',
'yi',
'yue',
'zh',
'zh-hans',
'zh-hant',
'zu',
];

// export components types for use throughout codebase
Expand Down
Loading