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

View file

@ -2,6 +2,17 @@ import localization from 'ts/helpers/Localization';
localization.parse('ru', `
§ 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.scope: Фичи
§ sidebar.team.author: Сотрудники
@ -42,6 +53,7 @@ localization.parse('ru', `
§ page.team.author.commits: Коммитов
§ page.team.author.commitsSmall: коммитов
§ page.team.author.tasks: Задач
§ page.team.author.tasksSmall: задач
§ page.team.author.workedLosses: Дни с коммитами и без
§ page.team.author.worked: работа
§ page.team.author.losses: дни без коммитов
@ -124,6 +136,8 @@ localization.parse('ru', `
§ page.team.week.hasNotCommits: небыло коммитов
§ page.team.week.days: дней
§ page.team.week.tasks: задач
§ page.person.print.photo.title: Фотография
§ page.person.print.photo.description: место для фотографии
§ page.person.total.title: Основные характеристики
§ page.person.total.daysWorked.title: дней работы
§ page.person.total.daysWorked.description: Учтены только дни, в которые делались коммиты

View file

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

View file

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

View file

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

View file

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

View file

@ -18,8 +18,16 @@ function SideBar() {
<Switch
value={type || 'team'}
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) => {
if (newType === type) return;

View file

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

View file

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

View file

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