fix: missing translation richText link modal (#1573)

This commit is contained in:
Dan Ribbens
2022-12-03 12:29:33 -05:00
committed by GitHub
parent ca59efe396
commit 2dcada199c
4 changed files with 72 additions and 12 deletions

View File

@@ -1,36 +1,48 @@
import { Config } from '../../../../../../../../config/types';
import { Field } from '../../../../../../../../fields/config/types';
import { extractTranslations } from '../../../../../../../../translations/extractTranslations';
const translations = extractTranslations([
'fields:textToDisplay',
'fields:linkType',
'fields:chooseBetweenCustomTextOrDocument',
'fields:customURL',
'fields:internalLink',
'fields:enterURL',
'fields:chooseDocumentToLink',
'fields:openInNewTab',
]);
export const getBaseFields = (config: Config): Field[] => [
{
name: 'text',
label: 'Text to display',
label: translations['fields:textToDisplay'],
type: 'text',
required: true,
},
{
name: 'linkType',
label: 'Link Type',
label: translations['fields:linkType'],
type: 'radio',
required: true,
admin: {
description: 'Choose between entering a custom text URL or linking to another document.',
description: translations['fields:chooseBetweenCustomTextOrDocument'],
},
defaultValue: 'custom',
options: [
{
label: 'Custom URL',
label: translations['fields:customURL'],
value: 'custom',
},
{
label: 'Internal Link',
label: translations['fields:internalLink'],
value: 'internal',
},
],
},
{
name: 'url',
label: 'Enter a URL',
label: translations['fields:enterURL'],
type: 'text',
required: true,
admin: {
@@ -41,7 +53,7 @@ export const getBaseFields = (config: Config): Field[] => [
},
{
name: 'doc',
label: 'Choose a document to link to',
label: translations['fields:chooseDocumentToLink'],
type: 'relationship',
required: true,
relationTo: config.collections.map(({ slug }) => slug),
@@ -53,7 +65,7 @@ export const getBaseFields = (config: Config): Field[] => [
},
{
name: 'newTab',
label: 'Open in new tab',
label: translations['fields:openInNewTab'],
type: 'checkbox',
},
];

View File

@@ -1,5 +1,6 @@
import { Modal } from '@faceless-ui/modal';
import React from 'react';
import { useTranslation } from 'react-i18next';
import { MinimalTemplate } from '../../../../../..';
import Button from '../../../../../../elements/Button';
import X from '../../../../../../icons/X';
@@ -20,6 +21,8 @@ export const EditModal: React.FC<Props> = ({
fieldSchema,
modalSlug,
}) => {
const { t } = useTranslation('fields');
return (
<Modal
slug={modalSlug}
@@ -27,7 +30,7 @@ export const EditModal: React.FC<Props> = ({
>
<MinimalTemplate className={`${baseClass}__template`}>
<header className={`${baseClass}__header`}>
<h3>Edit Link</h3>
<h3>{t('editLink')}</h3>
<Button
buttonStyle="none"
onClick={close}
@@ -46,7 +49,7 @@ export const EditModal: React.FC<Props> = ({
forceRender
/>
<FormSubmit>
Confirm
{t('general:submit')}
</FormSubmit>
</Form>
</MinimalTemplate>

View File

@@ -90,23 +90,31 @@
"verificationTokenInvalid": "Verification token is invalid."
},
"fields": {
"block": "block",
"blocks": "blocks",
"addLabel": "Add {{label}}",
"addNew": "Add new",
"addNewLabel": "Add new {{label}}",
"addRelationship": "Add relationship",
"block": "block",
"blockType": "Block Type",
"blocks": "blocks",
"chooseBetweenCustomTextOrDocument": "Choose between entering a custom text URL or linking to another document.",
"chooseDocumentToLink": "Choose a document to link to",
"chooseFromExisting": "Choose from existing",
"chooseLabel": "Choose {{label}}",
"collapseAll": "Collapse All",
"customURL": "Custom URL",
"editLabelData": "Edit {{label}} data",
"editLink": "Edit Link",
"enterURL": "Enter a URL",
"internalLink": "Internal Link",
"itemsAndMore": "{{items}} and {{count}} more",
"labelRelationship": "{{label}} Relationship",
"latitude": "Latitude",
"linkType": "Link Type",
"linkedTo": "Linked to <0>{{label}}</0>",
"longitude": "Longitude",
"newLabel": "New {{label}}",
"openInNewTab": "Open in new tab",
"passwordsDoNotMatch": "Passwords do not match.",
"relatedDocument": "Related Document",
"relationTo": "Relation To",
@@ -116,6 +124,7 @@
"selectExistingLabel": "Select existing {{label}}",
"showAll": "Show All",
"swapUpload": "Swap Upload",
"textToDisplay": "Text to display",
"toggleBlock": "Toggle block",
"uploadNewLabel": "Upload new {{label}}"
},

View File

@@ -368,6 +368,33 @@
"blocks": {
"type": "string"
},
"chooseBetweenCustomTextOrDocument": {
"type": "string"
},
"chooseDocumentToLink":{
"type": "string"
},
"customURL": {
"type": "string"
},
"editLink":{
"type": "string"
},
"enterURL": {
"type": "string"
},
"internalLink":{
"type": "string"
},
"linkType": {
"type": "string"
},
"openInNewTab":{
"type": "string"
},
"textToDisplay": {
"type": "string"
},
"addLabel": {
"type": "string"
},
@@ -450,6 +477,15 @@
"required": [
"block",
"blocks",
"chooseBetweenCustomTextOrDocument",
"chooseDocumentToLink",
"customURL",
"editLink",
"enterURL",
"internalLink",
"linkType",
"openInNewTab",
"textToDisplay",
"addLabel",
"addNew",
"addNewLabel",