JIRA-1234 feat(lang): test test test

This commit is contained in:
bakhirev 2023-10-13 17:30:21 +03:00
parent 14bf6932ec
commit 9657773717
10 changed files with 67 additions and 35 deletions

View file

@ -1,6 +1,7 @@
import { makeObservable, observable, action } from 'mobx'; import { makeObservable, observable, action } from 'mobx';
import IMessage from '../interfaces/Message'; import IMessage from '../interfaces/Message';
import localization from "../../../helpers/Localization";
interface INotificationsStore { interface INotificationsStore {
timer: any; timer: any;
@ -31,7 +32,7 @@ class NotificationsStore implements INotificationsStore {
show(message?: any) { show(message?: any) {
this.messages.push({ this.messages.push({
id: NotificationsStore.getTime(), id: NotificationsStore.getTime(),
title: message?.title || message || 'Изменения сохранены', title: localization.get(message?.title || message || 'common.notifications.save'),
description: message?.description || '', description: message?.description || '',
type: message?.type || 'success', type: message?.type || 'success',
}); });

View file

@ -2,6 +2,17 @@ import localization from 'ts/helpers/Localization';
localization.parse('ru', ` localization.parse('ru', `
§ common.filters: Фильтры § common.filters: Фильтры
§ common.notifications.save: Изменения сохранены
§ common.notifications.setting: Настройки сохранены
§ sidebar.switch.team: Команда
§ sidebar.switch.person: Сотрудник
§ sidebar.buttons.settings: Настройки
§ sidebar.buttons.print: Печать
§ sidebar.filters.all: всё время
§ sidebar.filters.year: год
§ sidebar.filters.halfYear: пол года
§ sidebar.filters.month: месяц
§ sidebar.filters.week: неделя
§ sidebar.team.total: Общая информация § sidebar.team.total: Общая информация
§ sidebar.team.scope: Фичи § sidebar.team.scope: Фичи
§ sidebar.team.author: Сотрудники § sidebar.team.author: Сотрудники
@ -42,6 +53,7 @@ localization.parse('ru', `
§ page.team.author.commits: Коммитов § page.team.author.commits: Коммитов
§ page.team.author.commitsSmall: коммитов § page.team.author.commitsSmall: коммитов
§ page.team.author.tasks: Задач § page.team.author.tasks: Задач
§ page.team.author.tasksSmall: задач
§ page.team.author.workedLosses: Дни с коммитами и без § page.team.author.workedLosses: Дни с коммитами и без
§ page.team.author.worked: работа § page.team.author.worked: работа
§ page.team.author.losses: дни без коммитов § page.team.author.losses: дни без коммитов
@ -124,6 +136,8 @@ localization.parse('ru', `
§ page.team.week.hasNotCommits: небыло коммитов § page.team.week.hasNotCommits: небыло коммитов
§ page.team.week.days: дней § page.team.week.days: дней
§ page.team.week.tasks: задач § page.team.week.tasks: задач
§ page.person.print.photo.title: Фотография
§ page.person.print.photo.description: место для фотографии
§ page.person.total.title: Основные характеристики § page.person.total.title: Основные характеристики
§ page.person.total.daysWorked.title: дней работы § page.person.total.daysWorked.title: дней работы
§ page.person.total.daysWorked.description: Учтены только дни, в которые делались коммиты § page.person.total.daysWorked.description: Учтены только дни, в которые делались коммиты

View file

@ -1,6 +1,7 @@
import React from 'react'; import React from 'react';
import settingsStore from 'ts/store/Settings'; import settingsStore from 'ts/store/Settings';
import localization from 'ts/helpers/Localization';
import style from '../../styles/filters.module.scss'; import style from '../../styles/filters.module.scss';
@ -20,7 +21,7 @@ function Button({
settingsStore.setFilterByDateType(type); settingsStore.setFilterByDateType(type);
}} }}
> >
{title || ''} {localization.get(title)}
</button> </button>
); );
} }

View file

@ -19,23 +19,23 @@ function Logo() {
/> />
<div className={style.header_filters_fast}> <div className={style.header_filters_fast}>
<Button <Button
title="всё время" title="sidebar.filters.all"
type="all" type="all"
/> />
<Button <Button
title="год" title="sidebar.filters.year"
type="year" type="year"
/> />
<Button <Button
title="пол года" title="sidebar.filters.halfYear"
type="halfYear" type="halfYear"
/> />
<Button <Button
title="месяц" title="sidebar.filters.month"
type="month" type="month"
/> />
<Button <Button
title="неделя" title="sidebar.filters.week"
type="week" type="week"
/> />
</div> </div>

View file

@ -9,6 +9,7 @@ import style from '../../styles/header.module.scss';
import Title from './Title'; import Title from './Title';
import Filters from './Filters'; import Filters from './Filters';
import printStore from '../../store/Print'; import printStore from '../../store/Print';
import localization from "../../../../helpers/Localization";
const Header = observer((): React.ReactElement | null => { const Header = observer((): React.ReactElement | null => {
const navigate = useNavigate(); const navigate = useNavigate();
@ -23,7 +24,7 @@ const Header = observer((): React.ReactElement | null => {
<> <>
<Filters/> <Filters/>
<img <img
title="Печать" title={localization.get('sidebar.buttons.print')}
className={style.header_print} className={style.header_print}
src="./assets/menu/print.svg" src="./assets/menu/print.svg"
onClick={() => { onClick={() => {
@ -31,7 +32,7 @@ const Header = observer((): React.ReactElement | null => {
}} }}
/> />
<img <img
title="Настройки" title={localization.get('sidebar.buttons.settings')}
className={style.header_setting} className={style.header_setting}
src="./assets/menu/setting.svg" src="./assets/menu/setting.svg"
onClick={() => { onClick={() => {

View file

@ -1,5 +1,7 @@
import React from 'react'; import React from 'react';
import localization from 'ts/helpers/Localization';
import style from '../../styles/switch.module.scss'; import style from '../../styles/switch.module.scss';
interface ISwitchProps { interface ISwitchProps {
@ -13,25 +15,28 @@ function Switch({
options, options,
onChange, onChange,
}: ISwitchProps) { }: ISwitchProps) {
const buttons = options.map((item: any) => ( const buttons = options.map((item: any) => {
<div const title = localization.get(item?.title);
key={item?.title} return (
className={`${style.switch_item} ${value === item?.id ? style.selected : ''}`} <div
onClick={() => { key={title}
if (onChange) onChange(item?.id); className={`${style.switch_item} ${value === item?.id ? style.selected : ''}`}
}} onClick={() => {
> if (onChange) onChange(item?.id);
<img }}
className={style.switch_item_icon} >
src={item?.icon || ''} <img
alt={item?.title || ''} className={style.switch_item_icon}
title={item?.title || ''} src={item?.icon || ''}
/> alt={title || ''}
<span className={style.switch_item_title}> title={title || ''}
{item?.title || ''} />
</span> <span className={style.switch_item_title}>
</div> {title || ''}
)); </span>
</div>
);
});
return ( return (
<div className={style.switch}> <div className={style.switch}>

View file

@ -18,8 +18,16 @@ function SideBar() {
<Switch <Switch
value={type || 'team'} value={type || 'team'}
options={[ options={[
{ id: 'team', title: 'Команда', icon: './assets/switch/team.svg' }, {
{ id: 'person', title: 'Сотрудник', icon: './assets/switch/person.svg' }, id: 'team',
title: 'sidebar.switch.team',
icon: './assets/switch/team.svg',
},
{
id: 'person',
title: 'sidebar.switch.person',
icon: './assets/switch/person.svg',
},
]} ]}
onChange={(newType: string) => { onChange={(newType: string) => {
if (newType === type) return; if (newType === type) return;

View file

@ -8,6 +8,8 @@ import PageColumn from 'ts/components/Page/column';
import Title from 'ts/components/Title'; import Title from 'ts/components/Title';
import dataGripStore from 'ts/store/DataGrip'; import dataGripStore from 'ts/store/DataGrip';
import localization from 'ts/helpers/Localization';
import style from '../../styles/print.module.scss'; import style from '../../styles/print.module.scss';
const Total = observer((): React.ReactElement => { const Total = observer((): React.ReactElement => {
@ -21,10 +23,10 @@ const Total = observer((): React.ReactElement => {
<CardWithIcon <CardWithIcon
value="" value=""
icon="./assets/cards/work_days.png" icon="./assets/cards/work_days.png"
title="Фотография" title="page.person.print.photo.title"
/> />
<div className={style.place_for_photo}> <div className={style.place_for_photo}>
место для фотографии {localization.get('page.person.print.photo.description')}
</div> </div>
</PageColumn> </PageColumn>
<PageColumn> <PageColumn>

View file

@ -18,7 +18,7 @@ class FormStore extends Form {
const { saveSettings } = settingsApi; const { saveSettings } = settingsApi;
return this.submit(saveSettings, body, false) return this.submit(saveSettings, body, false)
.then((response: any) => { .then((response: any) => {
notificationsStore.show('Настройки сохранены'); notificationsStore.show('common.notifications.setting');
userSettings.loadUserSettings(); userSettings.loadUserSettings();
this.setInitState(this.state); this.setInitState(this.state);
return Promise.resolve(response); return Promise.resolve(response);

View file

@ -36,8 +36,8 @@ function AuthorView({ response, updateSort }: IAuthorViewProps) {
const textWork = localization.get('page.team.author.worked'); const textWork = localization.get('page.team.author.worked');
const textLosses = localization.get('page.team.author.losses'); const textLosses = localization.get('page.team.author.losses');
const daysWorked = getOptions({ order: [textWork, textLosses], suffix: 'дней' }); const daysWorked = getOptions({ order: [textWork, textLosses], suffix: 'page.team.author.days' });
const taskChart = getOptions({ max: getMaxByLength(response, 'tasks'), suffix: 'задач' }); const taskChart = getOptions({ max: getMaxByLength(response, 'tasks'), suffix: 'page.team.author.tasksSmall' });
const commitsChart = getOptions({ max: getMax(response, 'commits') }); const commitsChart = getOptions({ max: getMax(response, 'commits') });
const typeChart = getOptions({ order: dataGripStore.dataGrip.type.list }); const typeChart = getOptions({ order: dataGripStore.dataGrip.type.list });