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

Next available day/hour is not properly translated #9285

Open
micheh opened this issue Apr 23, 2024 · 4 comments
Open

Next available day/hour is not properly translated #9285

micheh opened this issue Apr 23, 2024 · 4 comments
Labels
Bug frontend Involves working with javascript ( Vue JS / CSS ) need-more-info This issue does not have enough information to start working on it.

Comments

@micheh
Copy link

micheh commented Apr 23, 2024

Describe the bug

When the working hours are set, the widget shows the time or day when agents will be back online. This works fine in English, but not so much in other languages. The problem is that there are some hard coded English strings in the mixing timeLeftToBackInOnline or the translations are not available like tomorrow:

timeLeftToBackInOnline() {
if (
this.hoursAndMinutesBackInOnline.hoursLeft >= 24 ||
(this.timeSlot.day !== this.currentDay && this.dayDiff === 0)
) {
const hourRelative = generateRelativeTime(
this.dayDiff + 1,
'days',
this.languageCode
);
return `${hourRelative}`;
}
if (
this.dayDiff >= 1 &&
this.presentHour >= this.currentDayTimings.closeHour
) {
return `on ${this.dayNameOfNextWorkingDay}`;
}
return this.hoursAndMinutesToBack;
},
},

This results in a mix of English and the other locale. In addition, the date string is added after the translation REPLY_TIME.BACK_IN. Other languages may have a different sentence structure and even if the relative dates strings are translated correctly, it will look strange when the time is added at the end.

To Reproduce

  1. Use the web widget with a locale different than English.
  2. Enable the working hours and make sure it is currently outside of the working hours
  3. Open the widget and see the wrong translated string

Expected behavior

No response

Environment

app.chatwoot.com

Cloud Provider

None

Platform

None

Operating system

No response

Browser and version

No response

Docker (if applicable)

No response

Additional context

No response

@micheh micheh added the Bug label Apr 23, 2024
Copy link

linear bot commented Apr 23, 2024

@vishnu-narayanan
Copy link
Member

@micheh Thank you for reporting this. If possible, could you share a screenshot of it? Which language are you using?

The only hard-coded string in this method would be days right. Anything else?

@vishnu-narayanan vishnu-narayanan added frontend Involves working with javascript ( Vue JS / CSS ) need-more-info This issue does not have enough information to start working on it. labels Apr 30, 2024
@micheh
Copy link
Author

micheh commented Apr 30, 2024

Hello @vishnu-narayanan, here is a screenshot:

image

I tested it with German (de), but could replicate the issue in other languages like French (fr), Italian (it) and Spanish (es).

Almost all methods in nextAvailabilityTime.js are affected.

generateRelativeTime returns an English string:

const hourRelative = generateRelativeTime(
this.dayDiff + 1,
'days',
this.languageCode
);

Line 172 returns the hard coded string on and the translated day:

return `on ${this.dayNameOfNextWorkingDay}`;

hoursAndMinutesToBack and the other methods used like exactTimeInAmPm also return hard coded strings:

hoursAndMinutesToBack() {
const { hoursLeft, minutesLeft } = this.hoursAndMinutesBackInOnline;
if (hoursLeft >= 3) {
return this.exactTimeInAmPm;
}
if (hoursLeft > 0 || minutesLeft > 0) {
return this.hoursAndMinutesLeft;
}
return 'in some time';

In the German language, the relative time should be in another place.
EN: We'll be back online tomorrow
DE: Wir werden morgen wieder online sein

@iamsivin
Copy link
Member

iamsivin commented Apr 30, 2024

@micheh Thank you for reporting the issue. We are currently working on a solution to fix the translation problem, as there is an open PR to address it. #9097
cc @vishnu-narayanan

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug frontend Involves working with javascript ( Vue JS / CSS ) need-more-info This issue does not have enough information to start working on it.
Projects
None yet
Development

No branches or pull requests

3 participants