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

Translate alternate text to Spanish #7552

Merged
Merged
Changes from 2 commits
Commits
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
3 changes: 2 additions & 1 deletion src/libs/OptionsListUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ function createOption(personalDetailList, report, {
const personalDetail = personalDetailList[0];
const hasDraftComment = hasReportDraftComment(report);
const hasOutstandingIOU = lodashGet(report, 'hasOutstandingIOU', false);
const isLastMessageAttachment = report ? ReportUtils.isReportMessageAttachment(report.lastMessageText) : false;
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
const isLastMessageAttachment = report ? ReportUtils.isReportMessageAttachment(report.lastMessageText) : false;

const iouReport = hasOutstandingIOU
? lodashGet(iouReports, `${ONYXKEYS.COLLECTION.REPORT_IOUS}${report.iouReportID}`, {})
: {};
Expand All @@ -230,7 +231,7 @@ function createOption(personalDetailList, report, {
? (hasMultipleParticipants && lastActorDetails
? `${lastActorDetails.displayName}: `
: '')
+ Str.htmlDecode(report.lastMessageText)
+ (isLastMessageAttachment ? `[${Localize.translateLocal('common.attachment')}]` : Str.htmlDecode(report.lastMessageText))
Copy link
Member

Choose a reason for hiding this comment

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

Could we please simplify this ternary? lets not nest it multi levels.

Copy link
Contributor Author

@sobitneupane sobitneupane Feb 8, 2022

Choose a reason for hiding this comment

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

This should be okay. Any suggestion?

    const lastMessageTextFromReport = isLastMessageAttachment ? `[${Localize.translateLocal('common.attachment')}]` : Str.htmlDecode(report.lastMessageText);
    const lastMessageText = report
        ? (hasMultipleParticipants && lastActorDetails
            ? `${lastActorDetails.displayName}: `
            : '')
        + (lastMessageTextFromReport)
        : '';

Copy link
Member

Choose a reason for hiding this comment

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

Let's break the concatenation into the next line.

const lastMessageTextFromReport = isLastMessageAttachment ? `[${Localize.translateLocal('common.attachment')}]` : Str.htmlDecode(report.lastMessageText);
 let lastMessageText = report && hasMultipleParticipants && lastActorDetails
            ? `${lastActorDetails.displayName}: `
            : '';
            
     lastMessageText  +=  report? lastMessageTextFromReport : '';

: '';

const tooltipText = ReportUtils.getReportParticipantsTitle(lodashGet(report, ['participants'], []));
Expand Down