-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Web - Task messages in Spanish are copied to clipboard in English #26621
Comments
This issue may fix in this #26571 And this is my proposal. ProposalPlease re-state the problem that we are trying to solve in this issue.Task messages in Spanish are copied to clipboard in English What is the root cause of that problem?Inconsistent between two text, the displayed text is the translated for actionName + task title, but the copied text is the originalMessage html What changes do you think we should make in order to solve the problem?We need to copy the translated for actionName + task title instead of originalMessage html function getTaskStatusMessageText(actionName, reportID) {
let taskStatusText = '';
switch (actionName) {
case CONST.REPORT.ACTIONS.TYPE.TASKCOMPLETED:
taskStatusText = Localize.translateLocal('task.messages.completed');
break;
case CONST.REPORT.ACTIONS.TYPE.TASKCANCELLED:
taskStatusText = Localize.translateLocal('task.messages.canceled');
break;
case CONST.REPORT.ACTIONS.TYPE.TASKREOPENED:
taskStatusText = Localize.translateLocal('task.messages.reopened');
break;
default:
taskStatusText = Localize.translateLocal('task.task');
}
return `${taskStatusText} ${allReports[reportID].reportName}`;
} and use it here onPress: (closePopover, {reportAction, selection, reportID}) => {
// const messageHtml = isTaskAction ? lodashGet(originalMessage, 'html', '') : lodashGet(message, 'html', '');
const messageHtml = isTaskAction ? ReportActionsUtils.getTaskStatusMessageText(reportAction.actionName, reportID) : lodashGet(message, 'html', ''); The function can use also in TaskAction.js What alternative solutions did you explore? (Optional)we can use |
Triggered auto assignment to @trjExpensify ( |
Bug0 Triage Checklist (Main S/O)
|
Proposal by: @AmjedNazzal ProposalAmjedNazzal on GH Please re-state the problem that we are trying to solve in this issue.Task messages in Spanish are copied to clipboard in English What is the root cause of that problem?The root cause here is that we are copying the task messages from the originalMessage html coming from the backend directly which is a problem since the backend only returns English messages for tasks.
What changes do you think we should make in order to solve the problem?To resolve this issue for this bug and related future bugs we can implement the method in TaskAction.js to start translating these task messages depending on the current language instead of getting it from the backend. export function useGetTaskStatusText(actionName, translateFn) {
let taskStatusText = '';
switch (actionName) {
case CONST.REPORT.ACTIONS.TYPE.TASKCOMPLETED:
taskStatusText = translateFn('task.messages.completed');
break;
case CONST.REPORT.ACTIONS.TYPE.TASKCANCELLED:
taskStatusText = translateFn('task.messages.canceled');
break;
case CONST.REPORT.ACTIONS.TYPE.TASKREOPENED:
taskStatusText = translateFn('task.messages.reopened');
break;
default:
taskStatusText = translateFn('task.task');
}
return taskStatusText;
} We can call this hook within TaskAction and within BaseReportActionContextMenu and pass it the actionName and translate hook in order to get the translated message. const taskStatusText = useGetTaskStatusText(props.actionName, props.translate); Inside of BaseReportActionContextMenu: const taskActionText = useGetTaskStatusText(props.reportAction.actionName, props.translate)
//Existing code
{_.map(_.filter(ContextMenuActions, shouldShowFilter), (contextAction) => {
const closePopup = !props.isMini;
const payload = {
..
taskActionText: taskActionText,
}; Finally we can use it in ContextMenuActions to set the messageHtml: onPress: (closePopover, {reportAction, selection, taskActionText}) => {
..
const messageHtml = isTaskAction ? taskActionText : lodashGet(message, 'html', ''); ResultScreen.Recording.2023-08-29.at.4.02.33.PM.mov |
ProposalPlease re-state the problem that we are trying to solve in this issue.Task messages in Spanish are copied to clipboard in English What is the root cause of that problem?We use originalMessage to get the text to be copied here -
Observe it contains semicolon. App/src/components/ReportActionItem/TaskAction.js Lines 57 to 63 in b95c1dd
That's why when we copy the message we are copying content directly while rendering we first translate and then display What changes do you think we should make in order to solve the problem?
For this we can create a new method in ReportActionUtils - const messageHtml = isTaskAction ? ReportActionsUtils.getTaskActionText(reportAction.actionName, lodashGet(originalMessage, 'title', '')) : lodashGet(message, 'html', ''); What alternative solutions did you explore? (Optional) |
Reproducible: @thienlnam assigning you for input on this one as it could be backend related. |
Yeah definitely part of the problem is that the reportAction message is set in the back-end. We could do a workaround and fix it in the front-end, or just close and wait until we support localization in the back-end. I don't feel super strongly since it's not really something that will happen often (copying the task system message) |
Are task system message the only ones translated? That's another inconsistency then really, isn't it? Why would we translate "completed task" but not "paid $xxx". CC: @JmillsExpensify has this come on your radar in Espanol? |
Okay, I can see the xiylELkMS6.mp4So I think the solution to this is more holistic than just on taskReports.
It doesn't feel that premium in the meantime, but I think I agree with preferring to hold off until we support localisation on the backend. |
Yeah sounds good, let's put this and related issues on hold then until we do back-end localization |
I think we just close it. It's not a bug, it's a limitation of how our implementation of translations work at this time. Once we commit to supporting localisation in the backend, that'll be a project in itself and all of these considerations will be accounted for holistically. |
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Action Performed:
Expected Result:
The pasted message should be in Spanish since we are already translating all these messages and making them available for the front end
Actual Result:
The messages are pasted in English which is inconsistent since they are being viewed in Spanish
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Version Number: 1.3.62.0
Reproducible in staging?: y
Reproducible in production?: y
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos: Any additional supporting documentation
Screen.Recording.2023-08-29.at.2.14.55.AM.mov
Expensify/Expensify Issue URL:
Issue reported by: @AmjedNazzal
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1693265369973669
View all open jobs on GitHub
The text was updated successfully, but these errors were encountered: