pl-api: Make translation provider field optional
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
parent
d6aa4bf388
commit
41a9c4183e
3 changed files with 11 additions and 4 deletions
|
@ -25,7 +25,6 @@ const translationSchema = v.pipe(
|
|||
if (translation?.text) return {
|
||||
content: translation.text,
|
||||
detected_source_language: translation.detected_language,
|
||||
provider: '',
|
||||
};
|
||||
|
||||
return translation;
|
||||
|
@ -37,7 +36,7 @@ const translationSchema = v.pipe(
|
|||
poll: v.fallback(v.optional(translationPollSchema), undefined),
|
||||
media_attachments: filteredArray(translationMediaAttachment),
|
||||
detected_source_language: v.string(),
|
||||
provider: v.string(),
|
||||
provider: v.fallback(v.nullable(v.string()), null),
|
||||
}),
|
||||
);
|
||||
|
||||
|
|
|
@ -87,7 +87,14 @@ const TranslateButton: React.FC<ITranslateButton> = ({ status }) => {
|
|||
<Stack space={3} alignItems='start'>
|
||||
{button}
|
||||
<Text theme='muted'>
|
||||
<FormattedMessage id='status.translated_from_with' defaultMessage='Translated from {lang} using {provider}' values={{ lang: languageName, provider }} />
|
||||
<FormattedMessage
|
||||
id='status.translated_from_with'
|
||||
defaultMessage='Translated from {lang} {provider}'
|
||||
values={{
|
||||
lang: languageName,
|
||||
provider: provider ? <FormattedMessage id='status.translated_from_with.provider' defaultMessage='with {provider}' values={{ provider }} /> : undefined,
|
||||
}}
|
||||
/>
|
||||
</Text>
|
||||
</Stack>
|
||||
);
|
||||
|
|
|
@ -1499,7 +1499,8 @@
|
|||
"status.title": "Post details",
|
||||
"status.title_direct": "Direct message",
|
||||
"status.translate": "Translate",
|
||||
"status.translated_from_with": "Translated from {lang} using {provider}",
|
||||
"status.translated_from_with": "Translated from {lang} {provider}",
|
||||
"status.translated_from_with.provider": "with {provider}",
|
||||
"status.translating": "Translating…",
|
||||
"status.unbookmark": "Remove bookmark",
|
||||
"status.unbookmarked": "Bookmark removed.",
|
||||
|
|
Loading…
Reference in a new issue