Skip to content

Commit

Permalink
Merge pull request #1193 from CruGlobal/8442-localize-labels
Browse files Browse the repository at this point in the history
[MPDX-8442] Localize more labels
  • Loading branch information
canac authored Nov 14, 2024
2 parents d7a008e + 74e9e8c commit c0745fa
Show file tree
Hide file tree
Showing 23 changed files with 514 additions and 138 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ const PartnerGivingAnalysisReportPage: React.FC = () => {
filterData?.accountList.partnerGivingAnalysisFilterGroups ?? [];
const reportFilterGroup = {
__typename: 'FilterGroup' as const,
name: 'Report Filters',
name: t('Report Filters'),
featured: true,
filters: sortBy(
groups
Expand All @@ -88,7 +88,7 @@ const PartnerGivingAnalysisReportPage: React.FC = () => {
),
};
return [reportFilterGroup, ...groups];
}, [filterData]);
}, [filterData, t]);

const handleClearSearch = () => {
reportRef.current?.clearSearchInput();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import { useUserPreference } from 'src/hooks/useUserPreference';
import theme from 'src/theme';
import {
TaskFilterTabsTypes,
taskFiltersTabs,
getTaskFiltersTabs,
} from 'src/utils/tasks/taskFilterTabs';
import {
TaskFiltersQuery,
Expand Down Expand Up @@ -122,6 +122,8 @@ const TasksPage: React.FC = () => {

//#region Filters

const taskFiltersTabs = useMemo(() => getTaskFiltersTabs(t), [t]);

const [taskType, setTaskType] = useState<TaskFilterTabsTypes>(
taskFiltersTabs[0].name,
);
Expand Down Expand Up @@ -311,15 +313,15 @@ const TasksPage: React.FC = () => {
)})`,
}}
>
{taskFiltersTabs.map((i) => (
{taskFiltersTabs.map((tab) => (
<Button
variant={
taskType === i.name ? 'contained' : 'outlined'
taskType === tab.name ? 'contained' : 'outlined'
}
onClick={() => setTaskTypeFilter(i.name)}
key={`btn-${i.name}`}
onClick={() => setTaskTypeFilter(tab.name)}
key={`btn-${tab.name}`}
>
{i.translated ? t(i.uiName) : i.uiName}
{tab.uiName}
</Button>
))}
</TaskCurrentHistoryButtonGroup>
Expand Down
2 changes: 2 additions & 0 deletions pages/accountLists/[accountListId]/tools/GetAppeals.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ query GetAppeals($accountListId: ID!, $after: String) {
nodes {
...AppealFields
}
totalCount
}
regularAppeals: appeals(
accountListId: $accountListId
Expand All @@ -17,6 +18,7 @@ query GetAppeals($accountListId: ID!, $after: String) {
nodes {
...AppealFields
}
totalCount
pageInfo {
endCursor
hasNextPage
Expand Down
113 changes: 91 additions & 22 deletions public/locales/en/translation.json

Large diffs are not rendered by default.

24 changes: 22 additions & 2 deletions public/locales/en/translation_old.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"ANNUAL": "Annual",
"Appointment": "Appointment",
"APPOINTMENT": "Appointment",
"Appointment Scheduled": "Appointment Scheduled",
"APPOINTMENT_SCHEDULED": "Appointment Scheduled",
"Appointments and Results": "Appointments and Results",
"Appt Produced": "Appt Produced",
Expand All @@ -34,7 +35,9 @@
"Ask in Future": "Ask in Future",
"Ask In Future": "Ask In Future",
"ASK_IN_FUTURE": "Ask In Future",
"Attempted": "Attempted",
"ATTEMPTED": "Attempted",
"Attempted - Left Message": "Attempted - Left Message",
"ATTEMPTED_LEFT_MESSAGE": "Attempted - Left Message",
"BOTH": "Both",
"Cake": "Cake",
Expand All @@ -44,6 +47,8 @@
"Call For Decision": "Call For Decision",
"CALL_FOR_DECISION": "Call For Decision",
"Calls": "Calls",
"Can't meet right now - circle back": "Can't meet right now - circle back",
"Cancelled-Need to reschedule": "Cancelled-Need to reschedule",
"Cannot upload file: file size cannot exceed 1MB": "Cannot upload file: file size cannot exceed 1MB",
"Cofirm {{value}}": "Cofirm {{value}}",
"Comments": "Comments",
Expand Down Expand Up @@ -97,6 +102,7 @@
"FACEBOOK_MESSAGE": "Facebook Message",
"Filter ({{count}})": "Filter ({{count}})",
"Filter ({{count}})_plural": "Filter ({{count}})",
"Follow up": "Follow up",
"Follow Up for Decision": "Follow Up for Decision",
"From: {{where}}": "From: {{where}}",
"Gifts": "Gifts",
Expand All @@ -111,12 +117,14 @@
"How the notification will be sent": "How the notification will be sent",
"If blank you will not be notified": "If blank you will not be notified",
"Import Tnt": "Import Tnt",
"In Person": "In Person",
"Incomplete": "Incomplete",
"Individual Completed": "Individual Completed",
"Initiate for Appointment": "Initiate for Appointment",
"Initiation": "Initiation",
"Last Gift": "Last Gift",
"Last Name is required": "Last Name is required",
"Letter": "Letter",
"LETTER": "Letter",
"List Separator": ", ",
"Magazine": "Magazine",
Expand Down Expand Up @@ -153,7 +161,9 @@
"No Contacts to show.": "No Contacts to show.",
"No Referrals": "No Referrals",
"No referrals to show.": "No referrals to show.",
"No Response Yet": "No Response Yet",
"NONE": "None",
"Not Interested": "Not Interested",
"NOT_INTERESTED": "Not Interested",
"Notification": "Notification",
"On your email newsletter list but has no people with a valid email address": "On your email newsletter list but has no people with a valid email address",
Expand All @@ -165,15 +175,18 @@
"Partner - Financial": "Partner - Financial",
"Partner - Pray": "Partner - Pray",
"Partner - Special": "Partner - Special",
"Partner Currency": "Partner Currency",
"PARTNER_FINANCIAL": "Partner - Financial",
"PARTNER_PRAY": "Partner - Pray",
"PARTNER_SPECIAL": "Partner - Special",
"Partner-Financial": "Partner-Financial",
"Partner-Pray": "Partner-Pray",
"Partner-Special": "Partner-Special",
"Period": "Period",
"Phone Calls": "Phone Calls",
"Phone Dials": "Phone Dials",
"PHYSICAL": "Physical",
"Platform": "Platform",
"Prayer Request": "Prayer Request",
"PRAYER_REQUEST": "Prayer Request",
"PRE_CALL_LETTER": "Pre-Call Letter",
"Pre-call": "Pre-call",
Expand All @@ -182,6 +195,7 @@
"Primary Appeal Updated": "Primary Appeal Updated",
"Print Icon": "Print Icon",
"QUARTERLY": "Quarterly",
"Reason / Helpscout Ticket Link": "Reason / Helpscout Ticket Link",
"received": "received",
"Received\u200c\u2060": "Received\u200c\u2060",
"RECEIVED": "Received",
Expand All @@ -203,7 +217,6 @@
"Resulting Appointments": "Resulting Appointments",
"Results": "Results",
"Ring": "Ring",
"Salary Currency": "Salary Currency",
"Saving setup phase failed.": "Saving setup phase failed.",
"Scheduled": "Scheduled",
"See All Account Lists": "See All Account Lists",
Expand All @@ -212,6 +225,8 @@
"Sent": "Sent",
"Showing {{count}}": "Showing {{count}}",
"Showing {{count}}_plural": "Showing {{count}}",
"Social Media": "Social Media",
"Special Gift Appeal": "Special Gift Appeal",
"Status: {{status}}": "Status: {{status}}",
"Stopping Impersonating and redirecting you to the legacy MPDX": "Stopping Impersonating and redirecting you to the legacy MPDX",
"Support": "Support",
Expand All @@ -223,21 +238,26 @@
"TALK_TO_IN_PERSON": "Talk To In Person",
"Talked To": "Talked To",
"Task logged successfully": "Task logged successfully",
"Text Message": "Text Message",
"TEXT_MESSAGE": "Text Message",
"Thank": "Thank",
"THANK": "Thank",
"Thank You": "Thank You",
"Thank You Note": "Thank You Note",
"Thank Yous": "Thank Yous",
"These {{number}} contacts have been previously excluded from this appeal. Are you certain you wish to add them?": "These {{number}} contacts have been previously excluded from this appeal. Are you certain you wish to add them?",
"This contact has been previously excluded from this appeal. Are you certain you wish to add them?": "This contact has been previously excluded from this appeal. Are you certain you wish to add them?",
"This is the primary email for every person in contacts marked as Newsletter-Email or Newsletter-Both. If they are marked as \"Opted out of Email Newsletter\", they are not included in this list.": "This is the primary email for every person in contacts marked as Newsletter-Email or Newsletter-Both. If they are marked as \"Opted out of Email Newsletter\", they are not included in this list.",
"This is the primary email for every person in the selected contacts. If they are marked as \"Opted out of Email Newsletter\", they are not included in this list.": "This is the primary email for every person in the selected contacts. If they are marked as \"Opted out of Email Newsletter\", they are not included in this list.",
"This will log you in on behalf of the user specified below. You will be able to see what the user sees on {{appName}}.\n Impersonation sessions have 20 minute timeout where you will automatically be logged out of the user's account after\n the specified amount of time. Once you are finished impersonating, click 'Exit Impersonation Mode' at the top of the\n page.": "This will log you in on behalf of the user specified below. You will be able to see what the user sees on {{appName}}.\n Impersonation sessions have 20 minute timeout where you will automatically be logged out of the user's account after\n the specified amount of time. Once you are finished impersonating, click 'Exit Impersonation Mode' at the top of the\n page.",
"To Do": "To Do",
"TO_DO": "To Do",
"Unexpand User Info Icon": "Unexpand User Info Icon",
"Unresponsive": "Unresponsive",
"UNRESPONSIVE": "Unresponsive",
"Update Information": "Update Information",
"User options updated!": "User options updated!",
"Video Call": "Video Call",
"Week on MPD:": "Week on MPD:",
"WEEKLY": "Weekly",
"Yearly": "Yearly",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
PersonEmailAddressInput,
PersonUpdateInput,
} from 'src/graphql/types.generated';
import { useEmailLocations } from 'src/hooks/useEmailLocations';
import { isEditableSource } from 'src/utils/sourceHelper';
import { ModalSectionContainer } from '../ModalSectionContainer/ModalSectionContainer';
import { ModalSectionDeleteIcon } from '../ModalSectionDeleteIcon/ModalSectionDeleteIcon';
Expand Down Expand Up @@ -68,6 +69,8 @@ export const PersonEmailItem: React.FC<Props> = ({
const [isEmailPrimaryChecked, setIsEmailPrimaryChecked] =
React.useState(false);

const locations = useEmailLocations();

const source = sources?.find((email) => email.id === emailAddress.id)?.source;

const locked = !isEditableSource(source);
Expand Down Expand Up @@ -134,17 +137,13 @@ export const PersonEmailItem: React.FC<Props> = ({
fullWidth
>
<MenuItem selected value="">
None
</MenuItem>
<MenuItem value="work" aria-label={t('Work')}>
{t('Work')}
</MenuItem>
<MenuItem value="personal" aria-label={t('Personal')}>
{t('Personal')}
</MenuItem>
<MenuItem value="other" aria-label={t('Other')}>
{t('Other')}
{t('None')}
</MenuItem>
{Object.entries(locations).map(([value, label]) => (
<MenuItem value={value} key={value}>
{label}
</MenuItem>
))}
</EmailSelect>
</FormControl>
</Grid>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
PersonPhoneNumberInput,
PersonUpdateInput,
} from 'src/graphql/types.generated';
import { usePhoneLocations } from 'src/hooks/usePhoneLocations';
import { isEditableSource } from 'src/utils/sourceHelper';
import { ModalSectionContainer } from '../ModalSectionContainer/ModalSectionContainer';
import { ModalSectionDeleteIcon } from '../ModalSectionDeleteIcon/ModalSectionDeleteIcon';
Expand Down Expand Up @@ -67,6 +68,8 @@ export const PersonPhoneNumberItem: React.FC<Props> = ({

const [isPrimaryChecked, setIsPrimaryChecked] = React.useState(false);

const locations = usePhoneLocations();

const source = sources?.find(
(number) => number.id === phoneNumber.id,
)?.source;
Expand Down Expand Up @@ -136,20 +139,13 @@ export const PersonPhoneNumberItem: React.FC<Props> = ({
fullWidth
>
<MenuItem selected value="">
None
</MenuItem>
<MenuItem value="mobile" aria-label={t('Mobile')}>
{t('Mobile')}
</MenuItem>
<MenuItem value="home" aria-label={t('Home')}>
{t('Home')}
</MenuItem>
<MenuItem value="work" aria-label={t('Work')}>
{t('Work')}
</MenuItem>
<MenuItem value="other" aria-label={t('Other')}>
{t('Other')}
{t('None')}
</MenuItem>
{Object.entries(locations).map(([value, label]) => (
<MenuItem value={value} key={value}>
{label}
</MenuItem>
))}
</PhoneNumberSelect>
</FormControl>
</Grid>
Expand Down
4 changes: 4 additions & 0 deletions src/components/DonationTable/DonationTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import { useTranslation } from 'react-i18next';
import { useFetchAllPages } from 'src/hooks/useFetchAllPages';
import { useLocalStorage } from 'src/hooks/useLocalStorage';
import { useLocale } from 'src/hooks/useLocale';
import { useDataGridLocaleText } from 'src/hooks/useMuiLocaleText';
import { currencyFormat, dateFormatShort } from 'src/lib/intlFormat';
import {
DynamicEditDonationModal,
Expand Down Expand Up @@ -362,6 +363,8 @@ export const DonationTable: React.FC<DonationTableProps> = ({
},
);

const localeText = useDataGridLocaleText();

return (
<>
{data?.donations.nodes.length ? (
Expand All @@ -384,6 +387,7 @@ export const DonationTable: React.FC<DonationTableProps> = ({
autoHeight
disableSelectionOnClick
disableVirtualization
localeText={localeText}
/>
{data.donations.pageInfo.hasNextPage ? (
<Box mx={8} my={2}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { DateTime } from 'luxon';
import { useTranslation } from 'react-i18next';
import { Maybe } from 'src/graphql/types.generated';
import { useLocale } from 'src/hooks/useLocale';
import { useDataGridLocaleText } from 'src/hooks/useMuiLocaleText';
import { currencyFormat, dateFormatShort } from 'src/lib/intlFormat';
import {
FinancialAccountContext,
Expand Down Expand Up @@ -290,6 +291,8 @@ export const AccountTransactionTable: React.FC<TableProps> = ({
},
];

const localeText = useDataGridLocaleText();

return (
<>
<StyledDataGrid
Expand All @@ -308,6 +311,7 @@ export const AccountTransactionTable: React.FC<TableProps> = ({
rowHeight={70}
autoHeight
getRowHeight={() => 'auto'}
localeText={localeText}
/>
<TotalsTable aria-label={t('Donation Totals')}>
<TableBody>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ describe('PartnerGivingAnalysisReport', () => {
).not.toBeInTheDocument();
});

expect(getByText('1120 of 120')).toBeInTheDocument();
expect(getByText('11-20 of 120')).toBeInTheDocument();
});

it('selects and unselects all', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
import { useGetPartnerGivingAnalysisIdsForMassSelectionQuery } from 'src/hooks/GetIdsForMassSelection.generated';
import { useDebouncedValue } from 'src/hooks/useDebounce';
import { useMassSelection } from 'src/hooks/useMassSelection';
import { useTablePaginationLocaleText } from 'src/hooks/useMuiLocaleText';
import { sanitizeFilters } from 'src/lib/sanitizeFilters';
import { useGetPartnerGivingAnalysisReportQuery } from './PartnerGivingAnalysisReport.generated';
import { PartnerGivingAnalysisReportTable as Table } from './Table/Table';
Expand Down Expand Up @@ -142,6 +143,8 @@ export const PartnerGivingAnalysisReport = forwardRef<
isRowChecked,
} = useMassSelection(allContactIds);

const localeText = useTablePaginationLocaleText();

const handleRequestSort = (
event: React.MouseEvent<unknown>,
property: string,
Expand Down Expand Up @@ -222,6 +225,7 @@ export const PartnerGivingAnalysisReport = forwardRef<
},
native: true,
}}
{...localeText}
/>
</>
) : (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ export const ImpersonateUserAccordion: React.FC<AccordionProps> = ({
required
id="reason"
name="reason"
label={t('Reason / Helpscout Ticket Link')}
label={t('Reason / HelpScout Ticket Link')}
type="reason"
value={reason}
disabled={isSubmitting}
Expand Down
Loading

0 comments on commit c0745fa

Please sign in to comment.