From 4707e4ed2e255e0524f0870ace0aeb79f67cd8f5 Mon Sep 17 00:00:00 2001 From: Davide Iadeluca Date: Wed, 2 Oct 2024 10:03:36 +0200 Subject: [PATCH] refactor(core): allow labels to be customized --- .../forum/components/PostStreamScrubber.js | 29 +++++++++++++++++-- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/framework/core/js/src/forum/components/PostStreamScrubber.js b/framework/core/js/src/forum/components/PostStreamScrubber.js index 4fe6b3ace7..5ab4fb7de3 100644 --- a/framework/core/js/src/forum/components/PostStreamScrubber.js +++ b/framework/core/js/src/forum/components/PostStreamScrubber.js @@ -3,6 +3,7 @@ import Component from '../../common/Component'; import icon from '../../common/helpers/icon'; import formatNumber from '../../common/utils/formatNumber'; import ScrollListener from '../../common/utils/ScrollListener'; +import { NestedStringArray } from '@askvortsov/rich-icu-message-formatter'; /** * The `PostStreamScrubber` component displays a scrubber which can be used to @@ -64,7 +65,7 @@ export default class PostStreamScrubber extends Component {
- {icon('fas fa-angle-double-up')} {app.translator.trans('core.forum.post_scrubber.original_post_link')} + {icon('fas fa-angle-double-up')} {this.firstPostLabel()}
@@ -79,12 +80,12 @@ export default class PostStreamScrubber extends Component {
- {app.translator.trans('core.forum.post_scrubber.unread_text', { count: unreadCount })} + {this.unreadLabel(unreadCount)}
- {icon('fas fa-angle-double-down')} {app.translator.trans('core.forum.post_scrubber.now_link')} + {icon('fas fa-angle-double-down')} {this.lastPostLabel()}
@@ -92,6 +93,28 @@ export default class PostStreamScrubber extends Component { ); } + /** + * @returns {NestedStringArray} + */ + firstPostLabel() { + return app.translator.trans('core.forum.post_scrubber.original_post_link'); + } + + /** + * @param {number} unreadCount + * @returns {NestedStringArray} + */ + unreadLabel(unreadCount) { + return app.translator.trans('core.forum.post_scrubber.unread_text', { count: unreadCount }); + } + + /** + * @returns {NestedStringArray} + */ + lastPostLabel() { + return app.translator.trans('core.forum.post_scrubber.now_link'); + } + onupdate(vnode) { super.onupdate(vnode);