Skip to content
Snippets Groups Projects
Unverified Commit cfa9ac09 authored by Ali Gradina's avatar Ali Gradina Committed by GitHub
Browse files

Translation for MonthCountSelector, index, SidebarCategory & SidebarGroup Component (#3363)

parent 420aad08
No related branches found
No related tags found
No related merge requests found
import React from 'react'; import React from 'react';
import { useTranslation } from 'react-i18next';
import { SvgCalendar } from '../../icons/v2'; import { SvgCalendar } from '../../icons/v2';
import { theme } from '../../style'; import { theme } from '../../style';
...@@ -29,6 +30,8 @@ export function MonthCountSelector({ ...@@ -29,6 +30,8 @@ export function MonthCountSelector({
maxMonths, maxMonths,
onChange, onChange,
}: MonthCountSelectorProps) { }: MonthCountSelectorProps) {
const { t } = useTranslation();
const { displayMax } = useBudgetMonthCount(); const { displayMax } = useBudgetMonthCount();
// It doesn't make sense to show anything if we can only fit one // It doesn't make sense to show anything if we can only fit one
...@@ -62,7 +65,7 @@ export function MonthCountSelector({ ...@@ -62,7 +65,7 @@ export function MonthCountSelector({
transform: 'scale(1.2)', transform: 'scale(1.2)',
}, },
}} }}
title="Choose the number of months shown at a time" title={t('Choose the number of months shown at a time')}
> >
{calendars} {calendars}
</View> </View>
......
// @ts-strict-ignore // @ts-strict-ignore
import React, { type CSSProperties, type Ref, useRef, useState } from 'react'; import React, { type CSSProperties, type Ref, useRef, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { import {
type CategoryGroupEntity, type CategoryGroupEntity,
...@@ -45,6 +46,8 @@ export function SidebarCategory({ ...@@ -45,6 +46,8 @@ export function SidebarCategory({
onDelete, onDelete,
onHideNewCategory, onHideNewCategory,
}: SidebarCategoryProps) { }: SidebarCategoryProps) {
const { t } = useTranslation();
const temporary = category.id === 'new'; const temporary = category.id === 'new';
const [menuOpen, setMenuOpen] = useState(false); const [menuOpen, setMenuOpen] = useState(false);
const triggerRef = useRef(null); const triggerRef = useRef(null);
...@@ -179,7 +182,7 @@ export function SidebarCategory({ ...@@ -179,7 +182,7 @@ export function SidebarCategory({
onBlur={() => onEditName(null)} onBlur={() => onEditName(null)}
style={{ paddingLeft: 13, ...(isLast && { borderBottomWidth: 0 }) }} style={{ paddingLeft: 13, ...(isLast && { borderBottomWidth: 0 }) }}
inputProps={{ inputProps={{
placeholder: temporary ? 'New Category Name' : '', placeholder: temporary ? t('New Category Name') : '',
}} }}
/> />
</View> </View>
......
// @ts-strict-ignore // @ts-strict-ignore
import React, { type CSSProperties, useRef, useState } from 'react'; import React, { type CSSProperties, useRef, useState } from 'react';
import { type ConnectDragSource } from 'react-dnd'; import { type ConnectDragSource } from 'react-dnd';
import { useTranslation } from 'react-i18next';
import { SvgExpandArrow } from '../../icons/v0'; import { SvgExpandArrow } from '../../icons/v0';
import { SvgCheveronDown } from '../../icons/v1'; import { SvgCheveronDown } from '../../icons/v1';
...@@ -50,6 +51,8 @@ export function SidebarGroup({ ...@@ -50,6 +51,8 @@ export function SidebarGroup({
onHideNewGroup, onHideNewGroup,
onToggleCollapse, onToggleCollapse,
}: SidebarGroupProps) { }: SidebarGroupProps) {
const { t } = useTranslation();
const temporary = group.id === 'new'; const temporary = group.id === 'new';
const [menuOpen, setMenuOpen] = useState(false); const [menuOpen, setMenuOpen] = useState(false);
const triggerRef = useRef(null); const triggerRef = useRef(null);
...@@ -123,13 +126,13 @@ export function SidebarGroup({ ...@@ -123,13 +126,13 @@ export function SidebarGroup({
setMenuOpen(false); setMenuOpen(false);
}} }}
items={[ items={[
{ name: 'add-category', text: 'Add category' }, { name: 'add-category', text: t('Add category') },
{ name: 'rename', text: 'Rename' }, { name: 'rename', text: t('Rename') },
!group.is_income && { !group.is_income && {
name: 'toggle-visibility', name: 'toggle-visibility',
text: group.hidden ? 'Show' : 'Hide', text: group.hidden ? t('Show') : t('Hide'),
}, },
onDelete && { name: 'delete', text: 'Delete' }, onDelete && { name: 'delete', text: t('Delete') },
]} ]}
/> />
</Popover> </Popover>
...@@ -197,7 +200,7 @@ export function SidebarGroup({ ...@@ -197,7 +200,7 @@ export function SidebarGroup({
style={{ fontWeight: 600 }} style={{ fontWeight: 600 }}
inputProps={{ inputProps={{
style: { marginLeft: 20 }, style: { marginLeft: 20 },
placeholder: temporary ? 'New Group Name' : '', placeholder: temporary ? t('New Group Name') : '',
}} }}
/> />
</View> </View>
......
// @ts-strict-ignore // @ts-strict-ignore
import React, { memo, useMemo, useState, useEffect } from 'react'; import React, { memo, useMemo, useState, useEffect } from 'react';
import { useTranslation } from 'react-i18next';
import { useDispatch } from 'react-redux'; import { useDispatch } from 'react-redux';
import { import {
...@@ -63,6 +64,7 @@ type BudgetInnerProps = { ...@@ -63,6 +64,7 @@ type BudgetInnerProps = {
}; };
function BudgetInner(props: BudgetInnerProps) { function BudgetInner(props: BudgetInnerProps) {
const { t } = useTranslation();
const currentMonth = monthUtils.currentMonth(); const currentMonth = monthUtils.currentMonth();
const spreadsheet = useSpreadsheet(); const spreadsheet = useSpreadsheet();
const dispatch = useDispatch(); const dispatch = useDispatch();
...@@ -173,7 +175,10 @@ function BudgetInner(props: BudgetInnerProps) { ...@@ -173,7 +175,10 @@ function BudgetInner(props: BudgetInnerProps) {
dispatch( dispatch(
addNotification({ addNotification({
type: 'error', type: 'error',
message: `Category ‘${name}’ already exists in group (May be Hidden)`, message: t(
'Category ‘{{name}}‘ already exists in group (May be Hidden)',
{ name },
),
}), }),
); );
}; };
......
---
category: Maintenance
authors: [agradina]
---
Support translations in desktop-client/components/budget.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment