Skip to content

Commit

Permalink
feat: FormEditor translations
Browse files Browse the repository at this point in the history
  • Loading branch information
asabotovich committed Apr 24, 2023
1 parent 9d70e2d commit 22b0d1e
Show file tree
Hide file tree
Showing 12 changed files with 242 additions and 445 deletions.
632 changes: 195 additions & 437 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"@next-auth/prisma-adapter": "1.0.5",
"@prisma/client": "4.11.0",
"@sentry/nextjs": "7.45.0",
"@taskany/bricks": "1.0.11",
"@taskany/bricks": "1.0.12",
"@taskany/colors": "1.0.4",
"@tippyjs/react": "4.2.6",
"apollo-server-micro": "3.12.0",
Expand Down Expand Up @@ -105,7 +105,7 @@
"concurrently": "7.6.0",
"cypress": "11.2.0",
"dotenv": "16.0.3",
"easy-typed-intl": "1.0.2",
"easy-typed-intl": "1.0.3",
"eslint": "8.33.0",
"eslint-config-airbnb": "19.0.4",
"eslint-config-next": "13.2.4",
Expand Down
2 changes: 1 addition & 1 deletion src/components/CommentForm/CommentForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ import {
FormCard,
FormAction,
FormActions,
FormEditor,
MarkdownIcon,
QuestionIcon,
nullable,
} from '@taskany/bricks';

import { FormEditor } from '../FormEditor/FormEditor';
import { usePageContext } from '../../hooks/usePageContext';
import { routes } from '../../hooks/router';
import { Tip } from '../Tip';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import getLang from '../../../i18n/getLang';
import ru from './ru.json';
import en from './en.json';

type I18nKey = keyof typeof ru & keyof typeof en;
export type I18nKey = keyof typeof ru & keyof typeof en;
type I18nLang = 'ru' | 'en';

const keyset: I18nLangSet<I18nKey> = {};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import getLang from '../../../i18n/getLang';
import ru from './ru.json';
import en from './en.json';

type I18nKey = keyof typeof ru & keyof typeof en;
export type I18nKey = keyof typeof ru & keyof typeof en;
type I18nLang = 'ru' | 'en';

const keyset: I18nLangSet<I18nKey> = {};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import getLang from '../../../i18n/getLang';
import ru from './ru.json';
import en from './en.json';

type I18nKey = keyof typeof ru & keyof typeof en;
export type I18nKey = keyof typeof ru & keyof typeof en;
type I18nLang = 'ru' | 'en';

const keyset: I18nLangSet<I18nKey> = {};
Expand Down
4 changes: 4 additions & 0 deletions src/components/FormEditor/FormEditor.i18n/en.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"Attach files by dragging & dropping, selecting or pasting them.": "Attach files by dragging & dropping, selecting or pasting them.",
"Uploading...": "Uploading..."
}
17 changes: 17 additions & 0 deletions src/components/FormEditor/FormEditor.i18n/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/* eslint-disable */
// Do not edit, use generator to update
import { i18n, fmt, I18nLangSet } from 'easy-typed-intl';
import getLang from '../../../i18n/getLang';

import ru from './ru.json';
import en from './en.json';

export type I18nKey = keyof typeof ru & keyof typeof en;
type I18nLang = 'ru' | 'en';

const keyset: I18nLangSet<I18nKey> = {};

keyset['ru'] = ru;
keyset['en'] = en;

export const tr = i18n<I18nLang, I18nKey>(keyset, fmt, getLang);
4 changes: 4 additions & 0 deletions src/components/FormEditor/FormEditor.i18n/ru.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"Attach files by dragging & dropping, selecting or pasting them.": "Прикрепляйте файлы, перетаскивая их, выбирая или вставляя их.",
"Uploading...": "Загрузка..."
}
14 changes: 14 additions & 0 deletions src/components/FormEditor/FormEditor.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { FC } from 'react';
import { FormEditor as FormEditorBricks } from '@taskany/bricks';

import { tr } from './FormEditor.i18n';

export const FormEditor: FC<React.ComponentProps<typeof FormEditorBricks>> = ({ ...props }) => (
<FormEditorBricks
messages={{
attachments: tr('Attach files by dragging & dropping, selecting or pasting them.'),
attachmentsUploading: tr('Uploading...'),
}}
{...props}
/>
);
2 changes: 1 addition & 1 deletion src/components/GoalForm/GoalForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ import {
FormInput,
FormActions,
FormAction,
FormEditor,
FormTitle,
ModalContent,
ModalHeader,
Tag,
} from '@taskany/bricks';

import { Project, EstimateInput, State, Tag as TagModel, Activity } from '../../../graphql/@generated/genql';
import { FormEditor } from '../FormEditor/FormEditor';
import { estimatedMeta } from '../../utils/dateTime';
import { errorsProvider } from '../../utils/forms';
import { usePageContext } from '../../hooks/usePageContext';
Expand Down
2 changes: 1 addition & 1 deletion src/schema/schema.i18n/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import getLang from '../../i18n/getLang';
import ru from './ru.json';
import en from './en.json';

type I18nKey = keyof typeof ru & keyof typeof en;
export type I18nKey = keyof typeof ru & keyof typeof en;
type I18nLang = 'ru' | 'en';

const keyset: I18nLangSet<I18nKey> = {};
Expand Down

0 comments on commit 22b0d1e

Please sign in to comment.