From aecd9d8fda932cc2229a84a45937877b20625758 Mon Sep 17 00:00:00 2001 From: Ryan Cao <70191398+ryanccn@users.noreply.github.com> Date: Wed, 6 Sep 2023 01:46:33 +0800 Subject: [PATCH] feat(memberCount): format count according to user locale (#1679) --- src/plugins/memberCount.tsx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/plugins/memberCount.tsx b/src/plugins/memberCount.tsx index 7f8b868e5..ecdb8afb8 100644 --- a/src/plugins/memberCount.tsx +++ b/src/plugins/memberCount.tsx @@ -30,6 +30,9 @@ const ChannelMemberStore = findStoreLazy("ChannelMemberStore") as FluxStore & { getProps(guildId: string, channelId: string): { groups: { count: number; id: string; }[]; }; }; +const sharedIntlNumberFormat = new Intl.NumberFormat(); +const numberFormat = (value: number) => sharedIntlNumberFormat.format(value); + function MemberCount() { const { id: channelId, guild_id: guildId } = useStateFromStores([SelectedChannelStore], () => getCurrentChannel()); const { groups } = useStateFromStores( @@ -57,7 +60,7 @@ function MemberCount() { alignContent: "center", gap: 0 }}> - + {props => (
- {online} + {numberFormat(online)}
)}
- + {props => (
- {total} + {numberFormat(total)}
)}