Skip to content

Commit

Permalink
Fix error with string interpolation (#1509)
Browse files Browse the repository at this point in the history
* Some additions in Russian localization

* Another additions in Russian localization

* Fix errors with single quotes

* Fix error with string interpolation

Must use backticks instead quotes

* Add fallback for browsers without Intl support

Not sure if it's right, since I don't have a browser without Intl support

* Add changes for PR[#1509]

* Code formatting
  • Loading branch information
odysseus1973 authored and compulim committed Dec 21, 2018
1 parent 7b745f6 commit 833ef75
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

### Changed
- Moved `botAvatarImage` and `userAvatarImage` to `styleOptions.botAvatarImage` and `styleOptions.userAvatarImage` respectively, in PR [#1486](https://github.com/Microsoft/BotFramework-WebChat/pull/1486)
- Fix string interpolation error in Russian localization and fallback for browsers without Intl support by [@odysseus1973](https://github.com/odysseus1973) in PR [#1509](https://github.com/Microsoft/BotFramework-WebChat/pull/1509)

### Fixed
- Fix [#1360](https://github.com/Microsoft/BotFramework-WebChat/issues/1360). Added `roles` to components of Web Chat, by [@corinagum](https://github.com/corinagum) in PR [#1462](https://github.com/Microsoft/BotFramework-WebChat/pull/1462)
Expand Down
19 changes: 15 additions & 4 deletions packages/component/src/Localization/ru-RU.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,32 @@ function xMinutesAgo(date) {
} else if (deltaInMinutes === 1) {
return 'Минуту назад';
} else if (deltaInHours < 1 && deltaInMinutes < 5) {
return '${ deltaInMinutes } минуты назад';
return `${ deltaInMinutes } минуты назад`;
} else if (deltaInHours < 1 && deltaInMinutes >= 5) {
return '${ deltaInMinutes } минут назад';
return `${ deltaInMinutes } минут назад`;
} else if (deltaInHours === 1) {
return 'Час назад';
} else if (deltaInHours < 5) {
return '${ deltaInHours } часа назад';
return `${ deltaInHours } часа назад`;
} else if (deltaInHours <= 24) {
return 'Сегодня';
} else if (deltaInHours <= 48) {
return 'Вчера';
} else if (deltaInHours <= 72) {
return 'Позавчера';
} else {
} else if (window.Intl) {
return new Intl.DateTimeFormat('ru-RU').format(date);
} else {
return date.toLocaleString(
'ru-RU',
{
year: 'numeric',
month: '2-digit',
day: '2-digit',
hour: '2-digit',
minute: '2-digit'
}
);
}
}

Expand Down

0 comments on commit 833ef75

Please sign in to comment.