stream_pill: Update `format_stream_name_and_subscriber_count`.

Use `$t` to ensure the function returns a translatable string.
This commit is contained in:
sanchi-t 2024-06-20 01:30:56 +05:30 committed by Tim Abbott
parent 7580130873
commit 445ff79e10
2 changed files with 6 additions and 2 deletions

View File

@ -1,3 +1,4 @@
import {$t} from "./i18n";
import type {InputPillContainer, InputPillItem} from "./input_pill";
import * as peer_data from "./peer_data";
import * as stream_data from "./stream_data";
@ -16,7 +17,10 @@ export type StreamPillData = StreamSubscription & {type: "stream"};
function format_stream_name_and_subscriber_count(sub: StreamSubscription): string {
const sub_count = peer_data.get_subscriber_count(sub.stream_id);
return "#" + sub.name +": " + sub_count + " users";
return $t(
{defaultMessage: "#{stream_name}: {sub_count} users"},
{stream_name: sub.name, sub_count},
);
}
export function create_item_from_stream_name(

View File

@ -33,7 +33,7 @@ const sweden_pill = {
stream_name: sweden.name,
stream_id: sweden.stream_id,
type: "stream",
display_value: "#Sweden: 5 users",
display_value: "translated: #Sweden: 5 users",
};
const subs = [denmark, sweden];