mirror of
https://github.com/actualbudget/actual.git
synced 2026-03-21 15:36:50 -05:00
📚 Missing translations [rules and to budget] (#4770)
* Missing translations * md * wrong md name
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import React, { type CSSProperties, type MouseEventHandler } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
import { Block } from '@actual-app/components/block';
|
||||
import { styles } from '@actual-app/components/styles';
|
||||
@@ -35,6 +36,7 @@ export function ToBudgetAmount({
|
||||
isTotalsListTooltipDisabled = false,
|
||||
onContextMenu,
|
||||
}: ToBudgetAmountProps) {
|
||||
const { t } = useTranslation();
|
||||
const sheetName = useEnvelopeSheetName(envelopeBudget.toBudget);
|
||||
const sheetValue = useEnvelopeSheetValue({
|
||||
name: envelopeBudget.toBudget,
|
||||
@@ -52,7 +54,7 @@ export function ToBudgetAmount({
|
||||
|
||||
return (
|
||||
<View style={{ alignItems: 'center', ...style }}>
|
||||
<Block>{isNegative ? 'Overbudgeted:' : 'To Budget:'}</Block>
|
||||
<Block>{isNegative ? t('Overbudgeted:') : t('To Budget:')}</Block>
|
||||
<View>
|
||||
<Tooltip
|
||||
content={
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { useState, useRef, useEffect, useReducer } from 'react';
|
||||
import React, { useState, useRef, useEffect, useReducer, useMemo } from 'react';
|
||||
import { FocusScope } from 'react-aria';
|
||||
import { Form } from 'react-aria-components';
|
||||
import { useHotkeys } from 'react-hotkeys-hook';
|
||||
@@ -264,6 +264,18 @@ export function FilterButton({ onApply, compact, hover, exclude }) {
|
||||
|
||||
const dateFormat = useDateFormat() || 'MM/dd/yyyy';
|
||||
|
||||
const translatedFilterFields = useMemo(() => {
|
||||
const retValue = [...filterFields];
|
||||
|
||||
if (retValue && retValue.length > 0) {
|
||||
retValue.forEach(field => {
|
||||
field[1] = mapField(field[0]);
|
||||
});
|
||||
}
|
||||
|
||||
return retValue;
|
||||
}, []);
|
||||
|
||||
const [state, dispatch] = useReducer(
|
||||
(state, action) => {
|
||||
switch (action.type) {
|
||||
@@ -379,12 +391,12 @@ export function FilterButton({ onApply, compact, hover, exclude }) {
|
||||
onMenuSelect={name => {
|
||||
dispatch({ type: 'configure', field: name });
|
||||
}}
|
||||
items={filterFields
|
||||
items={translatedFilterFields
|
||||
.filter(f => (exclude ? !exclude.includes(f[0]) : true))
|
||||
.sort()
|
||||
.map(([name, text]) => ({
|
||||
name,
|
||||
text: titleFirst(mapField(text)),
|
||||
text: titleFirst(text),
|
||||
}))}
|
||||
/>
|
||||
</Popover>
|
||||
|
||||
@@ -237,6 +237,18 @@ function ConditionEditor({
|
||||
inputKey,
|
||||
} = condition;
|
||||
|
||||
const translatedConditions = useMemo(() => {
|
||||
const retValue = [...conditionFields];
|
||||
|
||||
if (retValue && retValue.length > 0) {
|
||||
retValue.forEach(field => {
|
||||
field[1] = mapField(field[0]);
|
||||
});
|
||||
}
|
||||
|
||||
return retValue;
|
||||
}, []);
|
||||
|
||||
let field = originalField;
|
||||
if (field === 'amount' && options) {
|
||||
if (options.inflow) {
|
||||
@@ -273,7 +285,7 @@ function ConditionEditor({
|
||||
return (
|
||||
<Editor style={editorStyle} error={error}>
|
||||
<FieldSelect
|
||||
fields={conditionFields}
|
||||
fields={translatedConditions}
|
||||
value={field}
|
||||
onChange={value => onChange('field', value)}
|
||||
/>
|
||||
@@ -581,6 +593,12 @@ function ConditionsList({
|
||||
onChangeConditions,
|
||||
}) {
|
||||
function addCondition(index) {
|
||||
if (conditionFields && conditionFields.length > 0) {
|
||||
conditionFields.forEach(field => {
|
||||
field[1] = mapField(field[0]);
|
||||
});
|
||||
}
|
||||
|
||||
// (remove the inflow and outflow pseudo-fields since they’d be a pain to get right)
|
||||
let fields = conditionFields
|
||||
.map(f => f[0])
|
||||
|
||||
Reference in New Issue
Block a user