Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added pluralization system for lang translations #45892

Merged
merged 32 commits into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
e69dd46
Added pluralization system for lang translations
shubham1206agra Jul 22, 2024
e7df141
Fix lint
shubham1206agra Jul 22, 2024
dbc34e6
Apply suggestions from code review
shubham1206agra Jul 25, 2024
7f91f9b
Apply suggestions from code review
shubham1206agra Jul 25, 2024
9e2861d
Merge branch 'main' into pluralizing-translation
shubham1206agra Jul 29, 2024
c8dd8d1
Apply suggestions from code review
shubham1206agra Jul 29, 2024
3a15ab3
Fixed unused type
shubham1206agra Jul 30, 2024
8af7a6f
Merge branch 'main' into pluralizing-translation
shubham1206agra Jul 30, 2024
fd0b5e7
Fixed lint
shubham1206agra Jul 30, 2024
e29c4bf
Fixed lint
shubham1206agra Jul 30, 2024
c4c5787
Merge main
shubham1206agra Aug 1, 2024
5eed7b5
Apply suggestions
shubham1206agra Aug 1, 2024
426d50e
Apply suggestions
shubham1206agra Aug 1, 2024
104979e
Merge branch 'main' into pluralizing-translation
shubham1206agra Aug 5, 2024
158b4c9
Polyfill plural rules for hermes
shubham1206agra Aug 5, 2024
2c7a937
Adjusting position of code
shubham1206agra Aug 5, 2024
14ae63c
Merge branch 'main' into pluralizing-translation
shubham1206agra Aug 6, 2024
2428dfa
Applying suggestion
shubham1206agra Aug 8, 2024
458e9de
Merge branch 'Expensify:main' into pluralizing-translation
shubham1206agra Aug 8, 2024
8155283
Adjusting code
shubham1206agra Aug 8, 2024
c6e69d4
Merge branch 'main' into pluralizing-translation
shubham1206agra Aug 16, 2024
b389316
Apply suggestions from code review
shubham1206agra Aug 16, 2024
6dfb0cd
Apply suggestions from code review
shubham1206agra Aug 16, 2024
08d02c7
Merge branch 'main' into pluralizing-translation
shubham1206agra Aug 23, 2024
8951084
Apply suggestions from code review
shubham1206agra Aug 23, 2024
29124ea
Post merge fixes
shubham1206agra Aug 23, 2024
ff9113a
Merge branch 'main' into pluralizing-translation
shubham1206agra Sep 3, 2024
4722de5
Post merge fixes
shubham1206agra Sep 3, 2024
b0cac2e
Merge branch 'main' into pluralizing-translation
shubham1206agra Sep 5, 2024
75ad856
Merge main
shubham1206agra Sep 27, 2024
1dde318
Merge conflicts
shubham1206agra Sep 27, 2024
e514a72
Fix backticks usage
shubham1206agra Sep 27, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/AddressForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ function AddressForm({
}
}
} else if (!CONST.GENERIC_ZIP_CODE_REGEX.test(values?.zipPostCode?.trim()?.toUpperCase() ?? '')) {
errors.zipPostCode = translate('privatePersonalDetails.error.incorrectZipFormat');
errors.zipPostCode = translate('privatePersonalDetails.error.incorrectZipFormat', undefined);
shubham1206agra marked this conversation as resolved.
Show resolved Hide resolved
}

return errors;
Expand Down
37 changes: 29 additions & 8 deletions src/components/ArchivedReportFooter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,35 @@ function ArchivedReportFooter({report, reportClosedAction, personalDetails = {}}
policyName = lodashEscape(policyName);
}

const text = shouldRenderHTML
? translate(`reportArchiveReasons.${archiveReason}`, {
displayName: `<strong>${displayName}</strong>`,
oldDisplayName: `<strong>${oldDisplayName}</strong>`,
policyName: `<strong>${policyName}</strong>`,
shouldUseYou: actorPersonalDetails?.accountID === getCurrentUserAccountID(),
})
: translate(`reportArchiveReasons.${archiveReason}`);
let text;
shubham1206agra marked this conversation as resolved.
Show resolved Hide resolved
switch (archiveReason) {
shubham1206agra marked this conversation as resolved.
Show resolved Hide resolved
case CONST.REPORT.ARCHIVE_REASON.ACCOUNT_CLOSED:
text = translate(`reportArchiveReasons.${archiveReason}`, {
displayName: `<strong>${displayName}</strong>`,
});
break;
case CONST.REPORT.ARCHIVE_REASON.ACCOUNT_MERGED:
text = translate(`reportArchiveReasons.${archiveReason}`, {
displayName: `<strong>${displayName}</strong>`,
oldDisplayName: `<strong>${oldDisplayName}</strong>`,
});
break;
case CONST.REPORT.ARCHIVE_REASON.REMOVED_FROM_POLICY:
text = translate(`reportArchiveReasons.${archiveReason}`, {
displayName: `<strong>${displayName}</strong>`,
policyName: `<strong>${policyName}</strong>`,
shouldUseYou: actorPersonalDetails?.accountID === getCurrentUserAccountID(),
});
break;
case CONST.REPORT.ARCHIVE_REASON.POLICY_DELETED:
text = translate(`reportArchiveReasons.${archiveReason}`, {
policyName: `<strong>${policyName}</strong>`,
});
break;
default:
text = translate(`reportArchiveReasons.${archiveReason}`);
break;
}

return (
<Banner
Expand Down
4 changes: 2 additions & 2 deletions src/components/MoneyReportHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -387,12 +387,12 @@ function MoneyReportHeader({policy, report: moneyRequestReport, transactionThrea
/>
)}
<ConfirmModal
title={translate('iou.deleteExpense')}
title={translate('iou.deleteExpense', undefined, 1)}
isVisible={isDeleteRequestModalVisible}
onConfirm={deleteTransaction}
onCancel={() => setIsDeleteRequestModalVisible(false)}
onModalHide={() => ReportUtils.navigateBackAfterDeleteTransaction(navigateBackToAfterDelete.current)}
prompt={translate('iou.deleteConfirmation')}
prompt={translate('iou.deleteConfirmation', undefined, 1)}
confirmText={translate('common.delete')}
cancelText={translate('common.cancel')}
danger
Expand Down
2 changes: 1 addition & 1 deletion src/components/ProcessMoneyReportHoldMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ function ProcessMoneyReportHoldMenu({
if (nonHeldAmount) {
return translate(isApprove ? 'iou.confirmApprovalAmount' : 'iou.confirmPayAmount');
}
return translate(isApprove ? 'iou.confirmApprovalAllHoldAmount' : 'iou.confirmPayAllHoldAmount', {transactionCount});
return translate(isApprove ? 'iou.confirmApprovalAllHoldAmount' : 'iou.confirmPayAllHoldAmount', undefined, transactionCount);
}, [nonHeldAmount, transactionCount, translate, isApprove]);

return (
Expand Down
2 changes: 1 addition & 1 deletion src/components/ReceiptAudit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function ReceiptAudit({notes, shouldShowAuditResult}: ReceiptAuditProps) {

let auditText = '';
if (notes.length > 0 && shouldShowAuditResult) {
auditText = translate('iou.receiptIssuesFound', notes.length);
auditText = translate('iou.receiptIssuesFound', undefined, notes.length);
} else if (!notes.length && shouldShowAuditResult) {
auditText = translate('common.verified');
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/ReportActionItem/ExportWithDropdownMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ function ExportWithDropdownMenu({policy, report, connectionName}: ExportWithDrop
title={translate('workspace.exportAgainModal.title')}
onConfirm={confirmExport}
onCancel={() => setModalStatus(null)}
prompt={translate('workspace.exportAgainModal.description', report?.reportName ?? '', connectionName)}
prompt={translate('workspace.exportAgainModal.description', {reportName: report?.reportName ?? '', connectionName})}
confirmText={translate('workspace.exportAgainModal.confirmText')}
cancelText={translate('workspace.exportAgainModal.cancelText')}
isVisible={!!modalStatus}
Expand Down
13 changes: 8 additions & 5 deletions src/components/ReportActionItem/ReportPreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -328,11 +328,14 @@ function ReportPreview({
return {supportText: formattedMerchant};
}
return {
supportText: translate('iou.expenseCount', {
count: numberOfRequests - numberOfScanningReceipts - numberOfPendingRequests,
scanningReceipts: numberOfScanningReceipts,
pendingReceipts: numberOfPendingRequests,
}),
supportText: translate(
'iou.expenseCount',
{
scanningReceipts: numberOfScanningReceipts,
pendingReceipts: numberOfPendingRequests,
},
numberOfRequests - numberOfScanningReceipts - numberOfPendingRequests,
),
};
}, [formattedMerchant, formattedDescription, moneyRequestComment, translate, numberOfRequests, numberOfScanningReceipts, numberOfPendingRequests]);

Expand Down
4 changes: 2 additions & 2 deletions src/components/Search/SearchListWithHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,8 @@ function SearchListWithHeader(
isVisible={deleteExpensesConfirmModalVisible}
onConfirm={handleDeleteExpenses}
onCancel={handleOnCancelConfirmModal}
title={translate('iou.deleteExpense', {count: selectedTransactionsToDelete.length})}
prompt={translate('iou.deleteConfirmation', {count: selectedTransactionsToDelete.length})}
title={translate('iou.deleteExpense', undefined, selectedTransactionsToDelete.length)}
prompt={translate('iou.deleteConfirmation', undefined, selectedTransactionsToDelete.length)}
confirmText={translate('common.delete')}
cancelText={translate('common.cancel')}
danger
Expand Down
2 changes: 1 addition & 1 deletion src/components/Search/SearchPageHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ function SearchPageHeader({
shouldAlwaysShowDropdownMenu
pressOnEnter
buttonSize={CONST.DROPDOWN_BUTTON_SIZE.MEDIUM}
customText={translate('workspace.common.selected', {selectedNumber: selectedTransactionsKeys.length})}
customText={translate('workspace.common.selected', undefined, selectedTransactionsKeys.length)}
shubham1206agra marked this conversation as resolved.
Show resolved Hide resolved
options={headerButtonsOptions}
isSplitButton={false}
/>
Expand Down
Loading
Loading