App icon indicating copy to clipboard operation
App copied to clipboard

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

Open aman-atg opened this issue 5 years ago • 16 comments

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?

  • [ :heavy_check_mark: ] Web
  • [ :heavy_check_mark: ] iOS
  • [ :heavy_check_mark: ] Android
  • [ :heavy_check_mark: ] Desktop App
  • [ :heavy_check_mark: ] 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 avatar Jul 25 '21 09:07 aman-atg

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

MelvinBot avatar Jul 25 '21 09:07 MelvinBot

Proposal

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

https://github.com/Expensify/App/blob/c00918712a050e92166954462c7b309164277d4e/src/libs/DateUtils.js#L56-L68

  • 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}`,
  });
}

aman-atg avatar Jul 25 '21 09:07 aman-atg

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

MelvinBot avatar Jul 26 '21 08:07 MelvinBot

We can hold this issue until https://github.com/Expensify/App/pull/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.

parasharrajat avatar Jul 26 '21 10:07 parasharrajat

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

aman-atg avatar Jul 26 '21 10:07 aman-atg

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

MelvinBot avatar Jul 26 '21 20:07 MelvinBot

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

TomatoToaster avatar Jul 26 '21 20:07 TomatoToaster

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

aman-atg avatar Jul 26 '21 20:07 aman-atg

job posted

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

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

kevinksullivan avatar Jul 28 '21 01:07 kevinksullivan

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

Done. (Proposal)

aman-atg avatar Jul 28 '21 03:07 aman-atg

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

TomatoToaster avatar Jul 30 '21 20:07 TomatoToaster

Ah already paid this one!

kevinksullivan avatar Aug 09 '21 12:08 kevinksullivan

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

aman-atg avatar Aug 09 '21 12:08 aman-atg

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

kevinksullivan avatar Aug 09 '21 14:08 kevinksullivan

Oh, sry about that. image

aman-atg avatar Aug 09 '21 14:08 aman-atg

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

kevinksullivan avatar Aug 09 '21 15:08 kevinksullivan