From cdbf82d9a0a5d970867b11707c157d38134b821f Mon Sep 17 00:00:00 2001 From: Maksim Sviridov Date: Tue, 16 May 2023 18:50:48 +0300 Subject: [PATCH] fix(i18n): unused translations keys --- .../ExplorePageLayout.i18n/en.json | 2 -- .../ExplorePageLayout.i18n/ru.json | 2 -- .../ExplorePageLayout/ExplorePageLayout.tsx | 1 - .../GoalEditForm/GoalEditForm.i18n/en.json | 3 --- .../GoalEditForm/GoalEditForm.i18n/ru.json | 3 --- src/components/GoalForm/GoalForm.i18n/en.json | 8 -------- src/components/GoalForm/GoalForm.i18n/ru.json | 8 -------- .../IssueDependenciesForm.i18n/en.json | 5 +---- .../IssueDependenciesForm.i18n/ru.json | 5 +---- .../IssueDependenciesForm.tsx | 15 ++++++++++++--- .../IssueDependenciesList.tsx | 8 +++++++- .../IssueParticipantsForm.i18n/en.json | 2 -- .../IssueParticipantsForm.i18n/ru.json | 2 -- src/components/PageHeader/PageHeader.i18n/en.json | 6 +----- src/components/PageHeader/PageHeader.i18n/ru.json | 6 +----- src/components/PageHeader/PageHeader.tsx | 8 -------- .../ProjectCreateForm.i18n/en.json | 7 ------- .../ProjectCreateForm.i18n/ru.json | 5 ----- src/components/RelativeTime/RelativeTime.tsx | 15 ++++++++------- .../UserSettingsPage.i18n/en.json | 3 --- .../UserSettingsPage.i18n/ru.json | 3 --- .../useCommentResource.i18n/en.json | 7 ------- .../useCommentResource.i18n/ru.json | 7 ------- .../useProjectResource.i18n/en.json | 4 ---- .../useProjectResource.i18n/ru.json | 4 ---- 25 files changed, 31 insertions(+), 108 deletions(-) diff --git a/src/components/ExplorePageLayout/ExplorePageLayout.i18n/en.json b/src/components/ExplorePageLayout/ExplorePageLayout.i18n/en.json index a2095b991..e6adcfe2e 100644 --- a/src/components/ExplorePageLayout/ExplorePageLayout.i18n/en.json +++ b/src/components/ExplorePageLayout/ExplorePageLayout.i18n/en.json @@ -1,6 +1,4 @@ { - "Teams": "Teams", - "Goals": "Goals", "Projects": "Projects", "Explore": "Explore", "See what the Taskany community is most excited about today": "See what the Taskany community is most excited about today", diff --git a/src/components/ExplorePageLayout/ExplorePageLayout.i18n/ru.json b/src/components/ExplorePageLayout/ExplorePageLayout.i18n/ru.json index ee91e87ad..c3eb2082a 100644 --- a/src/components/ExplorePageLayout/ExplorePageLayout.i18n/ru.json +++ b/src/components/ExplorePageLayout/ExplorePageLayout.i18n/ru.json @@ -1,6 +1,4 @@ { - "Teams": "Команды", - "Goals": "Цели", "Projects": "Проекты", "Explore": "Обзор", "See what the Taskany community is most excited about today": "Смотри, чем пользователи Taskany интересуются сегодня", diff --git a/src/components/ExplorePageLayout/ExplorePageLayout.tsx b/src/components/ExplorePageLayout/ExplorePageLayout.tsx index a54a3bae2..6845f877c 100644 --- a/src/components/ExplorePageLayout/ExplorePageLayout.tsx +++ b/src/components/ExplorePageLayout/ExplorePageLayout.tsx @@ -18,7 +18,6 @@ export const ExplorePageLayout: React.FC = ({ children } const tabsMenuOptions: Array<[string, string]> = [ [tr('Top'), routes.exploreTopProjects()], [tr('Projects'), routes.exploreProjects()], - // [tr('Goals'), routes.exploreGoals()], ]; return ( diff --git a/src/components/GoalEditForm/GoalEditForm.i18n/en.json b/src/components/GoalEditForm/GoalEditForm.i18n/en.json index b16630ac8..8b7cdacf5 100644 --- a/src/components/GoalEditForm/GoalEditForm.i18n/en.json +++ b/src/components/GoalEditForm/GoalEditForm.i18n/en.json @@ -1,7 +1,4 @@ { - "Something went wrong 😿": "Something went wrong 😿", - "We are saving your goal": "We are saving your goal...", - "Voila! Saved successfully 🎉": "Voila! Saved successfully 🎉", "Edit the goal": "Edit the goal", "Submit": "Save goal" } diff --git a/src/components/GoalEditForm/GoalEditForm.i18n/ru.json b/src/components/GoalEditForm/GoalEditForm.i18n/ru.json index 0ceb73c59..5b527f6cf 100644 --- a/src/components/GoalEditForm/GoalEditForm.i18n/ru.json +++ b/src/components/GoalEditForm/GoalEditForm.i18n/ru.json @@ -1,7 +1,4 @@ { - "Something went wrong 😿": "Упс! Что-то пошло не так 😿", - "We are saving your goal": "Погоди немного, сохраняем цель...", - "Voila! Saved successfully 🎉": "Ура! Сохранили цель 🎉", "Submit": "Сохранить", "Edit the goal": "Редактирование цели" } diff --git a/src/components/GoalForm/GoalForm.i18n/en.json b/src/components/GoalForm/GoalForm.i18n/en.json index 7f138bc1a..58559953f 100644 --- a/src/components/GoalForm/GoalForm.i18n/en.json +++ b/src/components/GoalForm/GoalForm.i18n/en.json @@ -1,17 +1,9 @@ { "Goal's title": "Goal's title", "And its description": "And its description", - "Goal's title is required": "Goal's title is required", - "Goal's title must be a string": "Goal's title must be a string", - "Goal's title must be longer than 10 symbols": "Goal's title must be longer than 10 symbols", - "Goal's description must be longer than 10 symbols": "Goal's description must be longer than 10 symbols", - "Goal's description is required": "Goal's description is required", - "Goal's description must be a string": "Goal's description must be a string", - "Goal's project or team are required": "Goal's project or team are required", "Assign": "Assign", "Enter name or email": "Name/Email", "Enter project or team title": "Team/Project", - "Schedule": "Schedule", "Date input mask placeholder": "mm/dd/yyyy", "Date input mask": "99/99/9999", "State": "State", diff --git a/src/components/GoalForm/GoalForm.i18n/ru.json b/src/components/GoalForm/GoalForm.i18n/ru.json index 893ca487c..2a0656bc8 100644 --- a/src/components/GoalForm/GoalForm.i18n/ru.json +++ b/src/components/GoalForm/GoalForm.i18n/ru.json @@ -1,15 +1,7 @@ { - "Goal's title is required": "Название цели обязательно", - "Goal's title must be a string": "Название цели должно быть строкой", - "Goal's title must be longer than 10 symbols": "Название цели должно быть длинее 10х символов", - "Goal's description must be longer than 10 symbols": "Описание цели должно быть длинее 10х символов", - "Goal's description is required": "Описание цели обязательно", - "Goal's description must be a string": "Описание цели должно быть строкой", - "Goal's project or team are required": "Проект или команда обязательны", "Assign": "Ответственный", "Enter name or email": "Имя/Почта", "Enter project or team title": "Команда/Проект", - "Schedule": "Срок", "Date input mask placeholder": "dd.mm.yyyy", "Date input mask": "99.99.9999", "State": "Статус", diff --git a/src/components/IssueDependenciesForm/IssueDependenciesForm.i18n/en.json b/src/components/IssueDependenciesForm/IssueDependenciesForm.i18n/en.json index 03ff72dd3..abc8e2ab4 100644 --- a/src/components/IssueDependenciesForm/IssueDependenciesForm.i18n/en.json +++ b/src/components/IssueDependenciesForm/IssueDependenciesForm.i18n/en.json @@ -3,9 +3,6 @@ "dependsOn": "Depends on", "blocks": "Blocks", "relatedTo": "Related", - "Does issue have dependencies": "Does issue have dependencies", "Add one": "Add one", - "Add dependency": "Add dependency", - "Kind": "Kind", - "Add": "Add" + "Add dependency": "Add dependency" } diff --git a/src/components/IssueDependenciesForm/IssueDependenciesForm.i18n/ru.json b/src/components/IssueDependenciesForm/IssueDependenciesForm.i18n/ru.json index 5e5407824..27e13010c 100644 --- a/src/components/IssueDependenciesForm/IssueDependenciesForm.i18n/ru.json +++ b/src/components/IssueDependenciesForm/IssueDependenciesForm.i18n/ru.json @@ -3,9 +3,6 @@ "dependsOn": "Зависит от", "blocks": "Заблокировано", "relatedTo": "Связано", - "Does issue have dependencies": "Ни от чего не зависит", "Add one": "Добавить", - "Add dependency": "Добавить зависимость", - "Kind": "Тип зависимости", - "Add": "Добавить" + "Add dependency": "Добавить зависимость" } diff --git a/src/components/IssueDependenciesForm/IssueDependenciesForm.tsx b/src/components/IssueDependenciesForm/IssueDependenciesForm.tsx index d762badce..fa1de1cf9 100644 --- a/src/components/IssueDependenciesForm/IssueDependenciesForm.tsx +++ b/src/components/IssueDependenciesForm/IssueDependenciesForm.tsx @@ -1,4 +1,4 @@ -import React, { ChangeEvent, useCallback, useState } from 'react'; +import React, { ChangeEvent, useCallback, useMemo, useState } from 'react'; import styled from 'styled-components'; import { gapL, gapM } from '@taskany/colors'; import { @@ -56,6 +56,15 @@ const IssueDependenciesForm: React.FC = ({ issue, on const { data: goalsData } = trpc.goal.suggestions.useQuery(query); + const dependKeys = useMemo( + () => ({ + [dependencyKind.blocks]: tr('blocks'), + [dependencyKind.dependsOn]: tr('dependsOn'), + [dependencyKind.relatedTo]: tr('relatedTo'), + }), + [], + ); + const onDependencyDelete = useCallback( (id: string, kind: dependencyKind) => { issue && @@ -163,7 +172,7 @@ const IssueDependenciesForm: React.FC = ({ issue, on ) } - text={kind ? tr(kind) : undefined} + text={kind ? dependKeys[kind] : undefined} ref={props.ref} onClick={props.onClick} /> @@ -176,7 +185,7 @@ const IssueDependenciesForm: React.FC = ({ issue, on onClick={props.onClick} view="primary" > - {tr(props.item)} + {dependKeys[props.item as dependencyKind]} )} /> diff --git a/src/components/IssueDependenciesList/IssueDependenciesList.tsx b/src/components/IssueDependenciesList/IssueDependenciesList.tsx index 17796e1eb..3c4f6bafe 100644 --- a/src/components/IssueDependenciesList/IssueDependenciesList.tsx +++ b/src/components/IssueDependenciesList/IssueDependenciesList.tsx @@ -80,13 +80,19 @@ export const IssueDependenciesListItem: React.FC }; export const IssueDependenciesList: React.FC = ({ issue, onDelete, onEdit }) => { + const dependKeys = { + [dependencyKind.blocks]: tr('blocks'), + [dependencyKind.dependsOn]: tr('dependsOn'), + [dependencyKind.relatedTo]: tr('relatedTo'), + }; + return ( <> {Object.values(dependencyKind).map((kind) => ( { href: routes.goals(), title: tr('Goals'), }, - // { - // href: '', - // title: t('Issues'), - // }, - // { - // href: '', - // title: t('Boards'), - // }, { href: routes.exploreTopProjects(), title: tr('Explore'), diff --git a/src/components/ProjectCreateForm/ProjectCreateForm.i18n/en.json b/src/components/ProjectCreateForm/ProjectCreateForm.i18n/en.json index d38c044b8..491694b38 100644 --- a/src/components/ProjectCreateForm/ProjectCreateForm.i18n/en.json +++ b/src/components/ProjectCreateForm/ProjectCreateForm.i18n/en.json @@ -1,20 +1,13 @@ { - "Ключ уже существует. Попробуй другой.": "Key {key} already exists. Please, try to use another key.", - "Ключ не может быть короче 3 символов": "Key must be 3 or longer characters", "New project": "New project", - "New team": "New team", "Create project": "Create project", - "Create team": "Create team", "Title": "Title", "Short description": "Short description", "Pro tip!": "Pro tip!", "Press key to create project": "Press {key} to create project.", - "Press key to create team": "Press {key} to create team.", "Key already exists": "Key {key} already exists. Please, try to use another key.", "Perfect! Issues and goals will look like": "{perfect} Issues and goals will look like: {issueKeyOne}, {issueKeyTwo}", "Key must be 3 or longer characters": "Key must be 3 or longer characters", - "Assign": "Assign", - "Enter name or email": "Enter name or email", "Flow": "Flow", "Flow or state title": "Flow or state title", "issue key one": "#{key}-42", diff --git a/src/components/ProjectCreateForm/ProjectCreateForm.i18n/ru.json b/src/components/ProjectCreateForm/ProjectCreateForm.i18n/ru.json index ef3055cfa..c2676d4a2 100644 --- a/src/components/ProjectCreateForm/ProjectCreateForm.i18n/ru.json +++ b/src/components/ProjectCreateForm/ProjectCreateForm.i18n/ru.json @@ -1,18 +1,13 @@ { "New project": "Новый проект", - "New team": "Новая команда", "Create project": "Создать проект", - "Create team": "Создать команду", "Title": "Название", "Short description": "Короткое описание", "Pro tip!": "Держи совет!", "Press key to create project": "Нажми {key} чтобы создать проект.", - "Press key to create team": "Нажми {key} чтобы создать команду.", "Key already exists": "Ключ {key} уже существует. Попробуй другой.", "Perfect! Issues and goals will look like": "{perfect} Задачи и цели будут выглядеть примерно так: {issueKeyOne}, {issueKeyTwo}.", "Key must be 3 or longer characters": "Ключ не может быть короче 3 символов", - "Assign": "Ответственный", - "Enter name or email": "Имя или почта", "Flow": "Флоу", "Flow or state title": "Модель или статус", "issue key one": "#{key}-42", diff --git a/src/components/RelativeTime/RelativeTime.tsx b/src/components/RelativeTime/RelativeTime.tsx index 8c00a4216..8e45b3234 100644 --- a/src/components/RelativeTime/RelativeTime.tsx +++ b/src/components/RelativeTime/RelativeTime.tsx @@ -15,12 +15,6 @@ interface RelativeTimeProps { date: Date; kind?: RelativeTimeKind; } -const map: Record = { - created: 'created', - updated: 'updated', - Created: 'Created', - Updated: 'Updated', -}; const RelativeTime: React.FC = ({ kind, date }) => { const { locale, ssrTime } = usePageContext(); @@ -32,6 +26,13 @@ const RelativeTime: React.FC = ({ kind, date }) => { setTime(Date.now()); }, [mounted]); + const map: Record = { + created: tr('created'), + updated: tr('updated'), + Created: tr('Created'), + Updated: tr('Updated'), + }; + useEffect(() => { const interval = setInterval(() => { setTime(Date.now()); @@ -42,7 +43,7 @@ const RelativeTime: React.FC = ({ kind, date }) => { return ( <> - {kind ? `${tr(map[kind])} ` : ''} + {kind ? map[kind] : ''} {dateAgo(localeDate, time, { locale })} ); diff --git a/src/components/UserSettingsPage/UserSettingsPage.i18n/en.json b/src/components/UserSettingsPage/UserSettingsPage.i18n/en.json index e5ef1052a..01625c390 100644 --- a/src/components/UserSettingsPage/UserSettingsPage.i18n/en.json +++ b/src/components/UserSettingsPage/UserSettingsPage.i18n/en.json @@ -1,7 +1,4 @@ { - "User name is required": "User name is required", - "User name must be a string": "User name must be a string", - "User name must be longer than 3 symbols": "User name must be longer than 3 symbol", "Something went wrong 😿": "Something went wrong 😿", "We are updating user settings": "We are updating user settings", "Voila! Successfully updated 🎉": "Voila! Successfully updated 🎉", diff --git a/src/components/UserSettingsPage/UserSettingsPage.i18n/ru.json b/src/components/UserSettingsPage/UserSettingsPage.i18n/ru.json index d3287afc6..b2c23c78d 100644 --- a/src/components/UserSettingsPage/UserSettingsPage.i18n/ru.json +++ b/src/components/UserSettingsPage/UserSettingsPage.i18n/ru.json @@ -1,7 +1,4 @@ { - "User name is required": "Указание имени обязательно", - "User name must be a string": "Имя должно быть строкой", - "User name must be longer than 3 symbols": "Имя не может быть короче 3х символов", "Something went wrong 😿": "Упс! Что-то пошло не так 😿", "We are updating user settings": "Обновляем настройки", "Voila! Successfully updated 🎉": "Ура! Успешно обновили 🎉", diff --git a/src/hooks/useCommentResource/useCommentResource.i18n/en.json b/src/hooks/useCommentResource/useCommentResource.i18n/en.json index c86cde500..e8286b266 100644 --- a/src/hooks/useCommentResource/useCommentResource.i18n/en.json +++ b/src/hooks/useCommentResource/useCommentResource.i18n/en.json @@ -1,16 +1,9 @@ { - "Comments's description is required": "Comments's description is required", - "Comments's description must be a string": "Comments's description must be a string", - "Comments's description must be longer than 1 symbol": "Comments's description must be longer than 1 symbol", "Something went wrong 😿": "Something went wrong 😿", "We are publishing your comment": "We are publishing your comment", "Voila! Comment is here 🎉": "Voila! Comment is here 🎉", "We are updating your comment": "We are updating your comment", "Comment updated": "Comment updated", - "Leave a comment": "Leave a comment...", - "Styling with markdown is supported": "Styling with markdown is supported", - "Comment": "Save", - "Cancel": "Cancel", "We are deleting your comment": "We are deleting your comment", "Comment removed": "Comment removed" } diff --git a/src/hooks/useCommentResource/useCommentResource.i18n/ru.json b/src/hooks/useCommentResource/useCommentResource.i18n/ru.json index 0f2441aa9..7b4b90192 100644 --- a/src/hooks/useCommentResource/useCommentResource.i18n/ru.json +++ b/src/hooks/useCommentResource/useCommentResource.i18n/ru.json @@ -1,16 +1,9 @@ { - "Comments's description is required": "Текст комментария обязателен", - "Comments's description must be a string": "Комментарий должен быть сторок", - "Comments's description must be longer than 1 symbol": "В комментарии должен быть хотя бы 1 символ", "Something went wrong 😿": "Упс! Что-то пошло не так 😿", "We are publishing your comment": "Погоди немного, сохраняем комментарий...", "Voila! Comment is here 🎉": "Ура! комментарий сохранен 🎉", "We are updating your comment": "Погоди немного, сохраняем комментарий...", "Comment updated": "Ура! комментарий сохранен 🎉", - "Leave a comment": "Оставить комментарий...", - "Styling with markdown is supported": "Текст можно стилизовать с помощью Markdown разметки", - "Comment": "Сохранить", - "Cancel": "Отменить", "We are deleting your comment": "Погоди немного, удаляем комментарий...", "Comment removed": "Комментарий удалён" } diff --git a/src/hooks/useProjectResource/useProjectResource.i18n/en.json b/src/hooks/useProjectResource/useProjectResource.i18n/en.json index 52f073579..418aa283c 100644 --- a/src/hooks/useProjectResource/useProjectResource.i18n/en.json +++ b/src/hooks/useProjectResource/useProjectResource.i18n/en.json @@ -1,8 +1,4 @@ { - "Title is required": "Title is required", - "Title must be a string": "Title must be a string", - "Title must be longer than 2 symbols": "Title must be longer than 2 symbols", - "Title can be 50 symbols maximum": "Title can be 50 symbols maximum", "Something went wrong 😿": "Something went wrong 😿", "We are creating something new": "We are creating something new", "Voila! It's here 🎉": "Voila! It is here 🎉", diff --git a/src/hooks/useProjectResource/useProjectResource.i18n/ru.json b/src/hooks/useProjectResource/useProjectResource.i18n/ru.json index 414194018..50062446e 100644 --- a/src/hooks/useProjectResource/useProjectResource.i18n/ru.json +++ b/src/hooks/useProjectResource/useProjectResource.i18n/ru.json @@ -1,8 +1,4 @@ { - "Title is required": "Название обязательно", - "Title must be a string": "Название должно быть строкой", - "Title must be longer than 2 symbols": "Название должно быть длинее 2х символов", - "Title can be 50 symbols maximum": "Название должно быть не длинее 50 символов", "Something went wrong 😿": "Упс! Что-то пошло не так 😿", "We are creating something new": "Погоди немного, создаем кое-что новое...", "Voila! It's here 🎉": "Ура! Всё готово 🎉",