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

[ESM] Localize system messages #43079

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
1f35f3b
translations wip
BrtqKr Jun 4, 2024
6df91bb
adjust params, cleanup
BrtqKr Jun 4, 2024
0feb9d8
add spanish translations, update delayed message
BrtqKr Jun 5, 2024
0566b14
update messages wip
BrtqKr Jun 17, 2024
e652a3e
apply types
BrtqKr Jun 20, 2024
ba75104
adjust types
BrtqKr Jun 20, 2024
8164d80
revert deprecated messages
BrtqKr Jun 20, 2024
fd96a70
cleanup
BrtqKr Jun 20, 2024
a3f0195
cleanup
BrtqKr Jun 24, 2024
2eedaf0
Merge remote-tracking branch 'origin/main' into brtqkr/42923-localize…
BrtqKr Jun 24, 2024
47226ed
cleanup
BrtqKr Jun 24, 2024
c907cb6
cleanup
BrtqKr Jun 24, 2024
6856ae3
update tests and remove depreacted messages
BrtqKr Jun 24, 2024
4ce20e1
remove utility function for checking modified fields
BrtqKr Jun 24, 2024
43a5ebd
fix unused types
BrtqKr Jun 24, 2024
2979207
run prettier
BrtqKr Jun 24, 2024
a4f9d4f
add original message condition
BrtqKr Jun 25, 2024
fd87079
remove condition
BrtqKr Jun 26, 2024
5d652b6
review fixes
BrtqKr Jun 26, 2024
16cbf19
Merge remote-tracking branch 'origin/main' into brtqkr/42923-localize…
BrtqKr Jun 26, 2024
af11678
modify conditions
BrtqKr Jun 26, 2024
641c337
Merge remote-tracking branch 'origin/main' into brtqkr/42923-localize…
BrtqKr Jun 26, 2024
9fdbcd6
modify conditions
BrtqKr Jun 26, 2024
32bdbe0
fix types
BrtqKr Jun 26, 2024
7e7a294
add label to integrationsMessage
BrtqKr Jun 28, 2024
ab51f36
remove todo
BrtqKr Jun 28, 2024
4b8c543
Merge remote-tracking branch 'origin/main' into brtqkr/42923-localize…
BrtqKr Jun 28, 2024
98a4d0f
add condition for no field
BrtqKr Jun 28, 2024
155937b
Merge remote-tracking branch 'origin/main' into brtqkr/42923-localize…
BrtqKr Jun 30, 2024
eb2550b
revert tests
BrtqKr Jun 30, 2024
a65a680
revert tests
BrtqKr Jun 30, 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
12 changes: 6 additions & 6 deletions src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -674,12 +674,12 @@ const CONST = {
CLOSED: 'CLOSED',
CREATED: 'CREATED',
DELEGATE_SUBMIT: 'DELEGATESUBMIT', // OldDot Action
DELETED_ACCOUNT: 'DELETEDACCOUNT', // OldDot Action
DELETED_ACCOUNT: 'DELETEDACCOUNT', // Deprecated OldDot Action
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's go ahead and just remove all the deprecated actions. They are blocked at the back end.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is sequenceNumber case covered as well? This temporary fallback has been there for over a year

    // HACK ALERT: We're temporarily filtering out any reportActions keyed by sequenceNumber
    // to prevent bugs during the migration from sequenceNumber -> reportActionID
    if (String(reportAction.sequenceNumber) === key) {
        Log.info('Front-end filtered out reportAction keyed by sequenceNumber!', false, reportAction);
        return true;
    }

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's leave that one be for now

DISMISSED_VIOLATION: 'DISMISSEDVIOLATION',
DONATION: 'DONATION', // OldDot Action
DONATION: 'DONATION', // Deprecated OldDot Action
EXPORTED_TO_CSV: 'EXPORTCSV', // OldDot Action
EXPORTED_TO_INTEGRATION: 'EXPORTINTEGRATION', // OldDot Action
EXPORTED_TO_QUICK_BOOKS: 'EXPORTED', // OldDot Action
EXPORTED_TO_QUICK_BOOKS: 'EXPORTED', // Deprecated OldDot Action
FORWARDED: 'FORWARDED', // OldDot Action
HOLD: 'HOLD',
HOLD_COMMENT: 'HOLDCOMMENT',
Expand All @@ -699,9 +699,9 @@ const CONST = {
REIMBURSEMENT_DELAYED: 'REIMBURSEMENTDELAYED', // OldDot Action
REIMBURSEMENT_QUEUED: 'REIMBURSEMENTQUEUED',
REIMBURSEMENT_DEQUEUED: 'REIMBURSEMENTDEQUEUED',
REIMBURSEMENT_REQUESTED: 'REIMBURSEMENTREQUESTED', // OldDot Action
REIMBURSEMENT_SETUP: 'REIMBURSEMENTSETUP', // OldDot Action
REIMBURSEMENT_SETUP_REQUESTED: 'REIMBURSEMENTSETUPREQUESTED', // OldDot Action
REIMBURSEMENT_REQUESTED: 'REIMBURSEMENTREQUESTED', // Deprecated OldDot Action
REIMBURSEMENT_SETUP: 'REIMBURSEMENTSETUP', // Deprecated OldDot Action
REIMBURSEMENT_SETUP_REQUESTED: 'REIMBURSEMENTSETUPREQUESTED', // Deprecated OldDot Action
RENAMED: 'RENAMED',
REPORT_PREVIEW: 'REPORTPREVIEW',
SELECTED_FOR_RANDOM_AUDIT: 'SELECTEDFORRANDOMAUDIT', // OldDot Action
Expand Down
41 changes: 41 additions & 0 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,35 @@ import type {
BeginningOfChatHistoryAnnounceRoomPartTwo,
BeginningOfChatHistoryDomainRoomPartOneParams,
CanceledRequestParams,
ChangeFieldParams,
ChangePolicyParams,
ChangeTypeParams,
CharacterLimitParams,
ConfirmThatParams,
DateShouldBeAfterParams,
DateShouldBeBeforeParams,
DelegateSubmitParams,
DeleteActionParams,
DeleteConfirmationParams,
DidSplitAmountMessageParams,
DistanceRateOperationsParams,
EditActionParams,
ElectronicFundsParams,
EnterMagicCodeParams,
ExportedToIntegrationParams,
FormattedMaxLengthParams,
ForwardedParams,
GoBackMessageParams,
GoToRoomParams,
InstantSummaryParams,
IntegrationsMessageParams,
LocalTimeParams,
LoggedInAsParams,
LogSizeParams,
ManagerApprovedAmountParams,
ManagerApprovedParams,
MarkedReimbursedParams,
MarkReimbursedFromIntegrationParams,
NoLongerHaveAccessParams,
NotAllowedExtensionParams,
NotYouParams,
Expand Down Expand Up @@ -65,17 +74,21 @@ import type {
SetTheRequestParams,
SettledAfterAddedBankAccountParams,
SettleExpensifyCardParams,
ShareParams,
SignUpNewFaceCodeParams,
SizeExceededParams,
SplitAmountParams,
StepCounterParams,
StripePaidParams,
TaskCreatedActionParams,
TermsParams,
ThreadRequestReportNameParams,
ThreadSentMoneyReportNameParams,
ToValidateLoginParams,
TransferParams,
TranslationBase,
UnapprovedParams,
UnshareParams,
UntilTimeParams,
UpdatedTheDistanceParams,
UpdatedTheRequestParams,
Expand Down Expand Up @@ -3022,6 +3035,34 @@ export default {
genericUpdateReportFieldFailureMessage: 'Unexpected error updating the field. Please try again later.',
genericUpdateReporNameEditFailureMessage: 'Unexpected error renaming the report. Please try again later.',
noActivityYet: 'No activity yet',
actions: {
type: {
changeField: ({oldValue, newValue, fieldName}: ChangeFieldParams) => `changed ${fieldName} from ${oldValue} to ${newValue}`,
changeFieldEmpty: ({newValue, fieldName}: ChangeFieldParams) => `changed ${fieldName} to ${newValue}`,
changePolicy: ({fromPolicy, toPolicy}: ChangePolicyParams) => `changed policy from ${fromPolicy} to ${toPolicy}`,
changeType: ({oldType, newType}: ChangeTypeParams) => `changed type from ${oldType} to ${newType}`,
delegateSubmit: ({delegateUser, originalManager}: DelegateSubmitParams) => `sent this report to ${delegateUser} since ${originalManager} is on vacation`,
exportedToCSV: `exported this report to CSV`,
exportedToIntegration: ({label}: ExportedToIntegrationParams) => `exported this report to ${label}`,
forwarded: ({amount, currency}: ForwardedParams) => `approved ${currency}${amount}`,
integrationsMessage: ({errorMessage, label}: IntegrationsMessageParams) => `failed to export this report to ${label}. ${errorMessage}`,
managerAttachReceipt: `added a receipt`,
managerDetachReceipt: `removed the receipt`,
markedReimbursed: ({amount, currency}: MarkedReimbursedParams) => `paid ${currency}${amount} elsewhere`,
markedReimbursedFromIntegration: ({amount, currency}: MarkReimbursedFromIntegrationParams) => `paid ${currency}${amount} via integration`,
outdatedBankAccount: `couldn’t process the payment due to a problem with the payer’s bank account`,
reimbursementACHBounce: `couldn’t process the payment, as the payer doesn’t have sufficient funds`,
reimbursementACHCancelled: `canceled the payment`,
reimbursementAccountChanged: `couldn’t process the payment, as the payer changed bank accounts`,
reimbursementDelayed: `processed the payment but it’s delayed by 1-2 more business days`,
selectedForRandomAudit: `[randomly selected](https://help.expensify.com/articles/expensify-classic/reports/Set-a-random-report-audit-schedule) for review`,
Copy link
Contributor

@Pujan92 Pujan92 Aug 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For this olddot action, it shows a message in a plain text instead of converted markdown which caused the issue #45819

share: ({to}: ShareParams) => `invited user ${to}`,
unshare: ({to}: UnshareParams) => `removed user ${to}`,
stripePaid: ({amount, currency}: StripePaidParams) => `paid ${currency}${amount}`,
takeControl: `took control`,
unapproved: ({amount, currency}: UnapprovedParams) => `unapproved ${currency}${amount}`,
},
},
},
chronos: {
oooEventSummaryFullDay: ({summary, dayCount, date}: OOOEventSummaryFullDayParams) => `${summary} for ${dayCount} ${dayCount === 1 ? 'day' : 'days'} until ${date}`,
Expand Down
41 changes: 41 additions & 0 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,14 @@ import type {
BeginningOfChatHistoryAnnounceRoomPartTwo,
BeginningOfChatHistoryDomainRoomPartOneParams,
CanceledRequestParams,
ChangeFieldParams,
ChangePolicyParams,
ChangeTypeParams,
CharacterLimitParams,
ConfirmThatParams,
DateShouldBeAfterParams,
DateShouldBeBeforeParams,
DelegateSubmitParams,
DeleteActionParams,
DeleteConfirmationParams,
DidSplitAmountMessageParams,
Expand All @@ -23,15 +27,20 @@ import type {
ElectronicFundsParams,
EnglishTranslation,
EnterMagicCodeParams,
ExportedToIntegrationParams,
FormattedMaxLengthParams,
ForwardedParams,
GoBackMessageParams,
GoToRoomParams,
InstantSummaryParams,
IntegrationsMessageParams,
LocalTimeParams,
LoggedInAsParams,
LogSizeParams,
ManagerApprovedAmountParams,
ManagerApprovedParams,
MarkedReimbursedParams,
MarkReimbursedFromIntegrationParams,
NoLongerHaveAccessParams,
NotAllowedExtensionParams,
NotYouParams,
Expand Down Expand Up @@ -65,16 +74,20 @@ import type {
SetTheRequestParams,
SettledAfterAddedBankAccountParams,
SettleExpensifyCardParams,
ShareParams,
SignUpNewFaceCodeParams,
SizeExceededParams,
SplitAmountParams,
StepCounterParams,
StripePaidParams,
TaskCreatedActionParams,
TermsParams,
ThreadRequestReportNameParams,
ThreadSentMoneyReportNameParams,
ToValidateLoginParams,
TransferParams,
UnapprovedParams,
UnshareParams,
UntilTimeParams,
UpdatedTheDistanceParams,
UpdatedTheRequestParams,
Expand Down Expand Up @@ -3058,6 +3071,34 @@ export default {
genericUpdateReportFieldFailureMessage: 'Error inesperado al actualizar el campo. Por favor, inténtalo más tarde.',
genericUpdateReporNameEditFailureMessage: 'Error inesperado al cambiar el nombre del informe. Por favor, intentarlo más tarde.',
noActivityYet: 'Sin actividad todavía',
actions: {
type: {
changeField: ({oldValue, newValue, fieldName}: ChangeFieldParams) => `cambió ${fieldName} de ${oldValue} a ${newValue}`,
changeFieldEmpty: ({newValue, fieldName}: ChangeFieldParams) => `cambió ${fieldName} a ${newValue}`,
changePolicy: ({fromPolicy, toPolicy}: ChangePolicyParams) => `cambió policy de ${fromPolicy} a ${toPolicy}`,
changeType: ({oldType, newType}: ChangeTypeParams) => `cambió type de ${oldType} a ${newType}`,
delegateSubmit: ({delegateUser, originalManager}: DelegateSubmitParams) => `envié este informe a ${delegateUser} ya que ${originalManager} está de vacaciones`,
exportedToCSV: `exportó este informe a CSV`,
exportedToIntegration: ({label}: ExportedToIntegrationParams) => `exportó este informe a ${label}`,
forwarded: ({amount, currency}: ForwardedParams) => `aprobado ${currency}${amount}`,
integrationsMessage: ({errorMessage, label}: IntegrationsMessageParams) => `no se pudo exportar este informe a ${label}. ${errorMessage}`,
managerAttachReceipt: `agregó un recibo`,
managerDetachReceipt: `quitó el recibo`,
markedReimbursed: ({amount, currency}: MarkedReimbursedParams) => `pagó ${currency}${amount} en otro lugar`,
markedReimbursedFromIntegration: ({amount, currency}: MarkReimbursedFromIntegrationParams) => `pagó ${currency}${amount} mediante integración`,
outdatedBankAccount: `no se pudo procesar el pago debido a un problema con la cuenta bancaria del pagador`,
reimbursementACHBounce: `no se pudo procesar el pago porque el pagador no tiene fondos suficientes`,
reimbursementACHCancelled: `canceled the payment`,
reimbursementAccountChanged: `no se pudo procesar el pago porque el pagador cambió de cuenta bancaria`,
reimbursementDelayed: `procesó el pago pero se retrasó entre 1 y 2 días hábiles más`,
selectedForRandomAudit: `[seleccionado al azar](https://help.expensify.com/articles/expensify-classic/reports/Set-a-random-report-audit-schedule) para revisión`,
share: ({to}: ShareParams) => `usuario invitado ${to}`,
unshare: ({to}: UnshareParams) => `usuario eliminado ${to}`,
stripePaid: ({amount, currency}: StripePaidParams) => `pagado ${currency}${amount}`,
takeControl: `tomó el control`,
unapproved: ({amount, currency}: UnapprovedParams) => `no aprobado ${currency}${amount}`,
},
},
},
chronos: {
oooEventSummaryFullDay: ({summary, dayCount, date}: OOOEventSummaryFullDayParams) => `${summary} por ${dayCount} ${dayCount === 1 ? 'día' : 'días'} hasta el ${date}`,
Expand Down
38 changes: 38 additions & 0 deletions src/languages/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,31 @@ type DistanceRateOperationsParams = {count: number};

type ReimbursementRateParams = {unit: Unit};

type ChangeFieldParams = {oldValue?: string; newValue: string; fieldName: string};

type ChangePolicyParams = {fromPolicy: string; toPolicy: string};

type ChangeTypeParams = {oldType: string; newType: string};

type DelegateSubmitParams = {delegateUser: string; originalManager: string};

type ExportedToIntegrationParams = {label: string};

type ForwardedParams = {amount: string; currency: string};

type IntegrationsMessageParams = {errorMessage: string; label: string};

type MarkedReimbursedParams = {amount: string; currency: string};

type MarkReimbursedFromIntegrationParams = {amount: string; currency: string};

type ShareParams = {to: string};

type UnshareParams = {to: string};

type StripePaidParams = {amount: string; currency: string};

type UnapprovedParams = {amount: string; currency: string};
type RemoveMembersWarningPrompt = {
memberName: string;
ownerName: string;
Expand Down Expand Up @@ -407,5 +432,18 @@ export type {
WelcomeNoteParams,
WelcomeToRoomParams,
ZipCodeExampleFormatParams,
ChangeFieldParams,
ChangePolicyParams,
ChangeTypeParams,
ExportedToIntegrationParams,
DelegateSubmitParams,
ForwardedParams,
IntegrationsMessageParams,
MarkedReimbursedParams,
MarkReimbursedFromIntegrationParams,
ShareParams,
UnshareParams,
StripePaidParams,
UnapprovedParams,
RemoveMembersWarningPrompt,
};
Loading
Loading