Skip to content

[Multi-language Support] No way of correctly translating time when messages were sent. #4219

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

Closed
aman-atg opened this issue Jul 25, 2021 · 16 comments
Assignees
Labels
Engineering External Added to denote the issue can be worked on by a contributor Weekly KSv2

Comments

@aman-atg
Copy link
Contributor

aman-atg commented Jul 25, 2021

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Action Performed:

  1. Login to New Expensify
  2. Go to profile settings
  3. Click on Preferences and Change the language to Spanish

Expected Result:

image

Actual Result:

image

Workaround:

Visual Issue

Platform:

Where is this issue occurring?

  • [ ✔️ ] Web
  • [ ✔️ ] iOS
  • [ ✔️ ] Android
  • [ ✔️ ] Desktop App
  • [ ✔️ ] Mobile Web

Version Number:
Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos: Any additional supporting documentation
Expensify/Expensify Issue URL:

View all open jobs on Upwork

@aman-atg aman-atg added the AutoAssignerTriage Auto assign issues for triage to an available triage team member label Jul 25, 2021
@MelvinBot
Copy link

Triggered auto assignment to @zanyrenney (AutoAssignerTriage), see https://stackoverflow.com/c/expensify/questions/4749 for more details.

@MelvinBot MelvinBot removed the AutoAssignerTriage Auto assign issues for triage to an available triage team member label Jul 25, 2021
@aman-atg
Copy link
Contributor Author

aman-atg commented Jul 25, 2021

Proposal

  • For proper date-time format, we need to make some changes in timestampToDateTime function inside DateUtils.js

function timestampToDateTime(locale, timestamp, includeTimeZone = false) {
const date = getLocalMomentFromTimestamp(locale, timestamp);
const tz = includeTimeZone ? ' [UTC]Z' : '';
return moment(date).calendar({
sameDay: `[Today at] LT${tz}`,
nextDay: `[Tomorrow at] LT${tz}`,
nextWeek: `MMM D [at] LT${tz}`,
lastDay: `[Yesterday at] LT${tz}`,
lastWeek: `MMM D [at] LT${tz}`,
sameElse: `MMM D, YYYY [at] LT${tz}`,
});
}

  • Here, moment.js can't automatically change the [ escaped characters ] , so we can make use of translate function like this (after adding locales)
function timestampToDateTime(locale, timestamp, includeTimeZone = false) {
  const date = getLocalMomentFromTimestamp(locale, timestamp);
  const tz = includeTimeZone ? ' [UTC]Z' : '';

  const todayAt = translate(locale, 'common.todayAt');
  const tomorrowAt = translate(locale, 'common.tomorrowAt');
  const yesterdayAt = translate(locale, 'common.yesterdayAt');
  const at = translate(locale, 'common.conjunctionAt');

  return moment(date).calendar({
      sameDay: `[${todayAt}] LT${tz}`,
      nextDay: `[${tomorrowAt}] LT${tz}`,
      lastDay: `[${yesterdayAt}] LT${tz}`,
      nextWeek: `MMM D [${at}] LT${tz}`,
      lastWeek: `MMM D [${at}] LT${tz}`,
      sameElse: `MMM D, YYYY [${at}] LT${tz}`,
  });
}

@zanyrenney zanyrenney removed their assignment Jul 26, 2021
@MelvinBot
Copy link

Triggered auto assignment to @TomatoToaster (Engineering), see https://stackoverflow.com/c/expensify/questions/4319 for more details.

@parasharrajat
Copy link
Member

We can hold this issue until #4090. I am adding a lot of missing translations there. After we should do an audit of the app to add all the missing translations and replace all the strings with translations whereever possible.

@aman-atg
Copy link
Contributor Author

aman-atg commented Jul 26, 2021

Translations can be added later but formatting date-time is still required which is the main issue here.

@aman-atg aman-atg changed the title Spanish translations aren't being used correctly at some places and no translation is there for date-time formatting [Multi-language Support] No way of correctly formatting date-time status Jul 26, 2021
@TomatoToaster TomatoToaster added the External Added to denote the issue can be worked on by a contributor label Jul 26, 2021
@MelvinBot
Copy link

Triggered auto assignment to @kevinksullivan (External), see https://stackoverflow.com/c/expensify/questions/8582 for more details.

@MelvinBot MelvinBot added Daily KSv2 and removed Weekly KSv2 labels Jul 26, 2021
@TomatoToaster TomatoToaster changed the title [Multi-language Support] No way of correctly formatting date-time status [Multi-language Support] No way of correctly translating time when messages were sent. Jul 26, 2021
@TomatoToaster
Copy link
Contributor

Alright I think this problem makes sense. Good catch! I like the proposal you made too, I think it makes sense for this problem.

In these cases, I'm not sure what the the next steps are. I think we just need the job to be made @kevinksullivan.

I renamed the title because I think it's more clear on what the problem is lmk what you think @aman-atg

@aman-atg
Copy link
Contributor Author

Thanks @TomatoToaster

I renamed the title because I think it's more clear on what the problem is lmk what you think @aman-atg

LGTM

@kevinksullivan
Copy link
Contributor

job posted

https://www.upwork.com/jobs/~010a0f724dd05272b1

@aman-atg add a proposal and I'll hire you!

@aman-atg
Copy link
Contributor Author

@aman-atg add a proposal and I'll hire you!

Done. (Proposal)

@TomatoToaster
Copy link
Contributor

Ah well the solution is merged, I think we just have the waiting period next.

@kevinksullivan
Copy link
Contributor

Ah already paid this one!

@aman-atg
Copy link
Contributor Author

aman-atg commented Aug 9, 2021

@kevinksullivan yes, but I think I didn't get the bonus for this one. ( Link )

@kevinksullivan
Copy link
Contributor

@aman-atg I don't have access to that page. Can you provide a screenshot?

@aman-atg
Copy link
Contributor Author

aman-atg commented Aug 9, 2021

Oh, sry about that.
image

@kevinksullivan
Copy link
Contributor

Ah thanks, I see our approach to bonuses changed. All set @aman-atg !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Engineering External Added to denote the issue can be worked on by a contributor Weekly KSv2
Projects
None yet
Development

No branches or pull requests

6 participants