Localise subscriber count on the watch page (#2841)

This commit is contained in:
absidue 2022-11-08 12:47:02 +01:00 committed by GitHub
parent 15546d99d3
commit 5addd304ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -367,12 +367,10 @@ export default Vue.extend({
const subCount = result.videoDetails.author.subscriber_count const subCount = result.videoDetails.author.subscriber_count
if (typeof (subCount) !== 'undefined' && !this.hideChannelSubscriptions) { if (typeof (subCount) !== 'undefined' && !this.hideChannelSubscriptions) {
if (subCount >= 1000000) { if (subCount >= 10000) {
this.channelSubscriptionCountText = `${subCount / 1000000}M` this.channelSubscriptionCountText = Intl.NumberFormat([this.currentLocale, 'en'], { notation: 'compact' }).format(subCount)
} else if (subCount >= 10000) {
this.channelSubscriptionCountText = `${subCount / 1000}K`
} else { } else {
this.channelSubscriptionCountText = Intl.NumberFormat(this.currentLocale).format(subCount) this.channelSubscriptionCountText = Intl.NumberFormat([this.currentLocale, 'en']).format(subCount)
} }
} }