* Updating translations.
* Use a number simplifier for counts. Fixes #407
-Subproject commit eee933bd87780e0e2a8700e9b8fe0047f14f428a
+Subproject commit 183033e0f796b450911e4e8f708ddd5969b12b77
isBrowser,
notifyComment,
notifyPrivateMessage,
+ numToSI,
setTheme,
showAvatars,
supportLemmyUrl,
"unread_messages"
)}`}
>
- {this.state.unreadCount}
+ {numToSI(this.state.unreadCount)}
</span>
)}
</button>
"unread_messages"
)}`}
>
- {this.state.unreadCount}
+ {numToSI(this.state.unreadCount)}
</span>
)}
</Link>
getUnixTime,
isMod,
mdToHtml,
+ numToSI,
setupTippy,
showScores,
wsClient,
class="mr-1 font-weight-bold"
aria-label={i18n.t("number_of_points", {
count: this.state.score,
+ formattedCount: this.state.score,
})}
>
- {this.state.score}
+ {numToSI(this.state.score)}
</span>
</a>
<span className="mr-1">•</span>
<Icon icon="arrow-up1" classes="icon-inline" />
{showScores() &&
this.state.upvotes !== this.state.score && (
- <span class="ml-1">{this.state.upvotes}</span>
+ <span class="ml-1">
+ {numToSI(this.state.upvotes)}
+ </span>
)}
</button>
{this.props.enableDownvotes && (
<Icon icon="arrow-down1" classes="icon-inline" />
{showScores() &&
this.state.upvotes !== this.state.score && (
- <span class="ml-1">{this.state.downvotes}</span>
+ <span class="ml-1">
+ {numToSI(this.state.downvotes)}
+ </span>
)}
</button>
)}
get pointsTippy(): string {
let points = i18n.t("number_of_points", {
count: this.state.score,
+ formattedCount: this.state.score,
});
let upvotes = i18n.t("number_of_upvotes", {
count: this.state.upvotes,
+ formattedCount: this.state.upvotes,
});
let downvotes = i18n.t("number_of_downvotes", {
count: this.state.downvotes,
+ formattedCount: this.state.downvotes,
});
return `${points} • ${upvotes} • ${downvotes}`;
getListingTypeFromPropsNoDefault,
getPageFromProps,
isBrowser,
+ numToSI,
setIsoData,
setOptionalAuth,
showLocal,
<td>
<CommunityLink community={cv.community} />
</td>
- <td class="text-right">{cv.counts.subscribers}</td>
- <td class="text-right">{cv.counts.users_active_month}</td>
+ <td class="text-right">
+ {numToSI(cv.counts.subscribers)}
+ </td>
+ <td class="text-right">
+ {numToSI(cv.counts.users_active_month)}
+ </td>
<td class="text-right d-none d-lg-table-cell">
- {cv.counts.posts}
+ {numToSI(cv.counts.posts)}
</td>
<td class="text-right d-none d-lg-table-cell">
- {cv.counts.comments}
+ {numToSI(cv.counts.comments)}
</td>
<td class="text-right">
{cv.subscribed ? (
} from "lemmy-js-client";
import { i18n } from "../../i18next";
import { UserService, WebSocketService } from "../../services";
-import { authField, getUnixTime, mdToHtml, wsClient } from "../../utils";
+import {
+ authField,
+ getUnixTime,
+ mdToHtml,
+ numToSI,
+ wsClient,
+} from "../../utils";
import { BannerIconHeader } from "../common/banner-icon-header";
import { Icon } from "../common/icon";
import { CommunityForm } from "../community/community-form";
return (
<ul class="my-1 list-inline">
<li className="list-inline-item badge badge-secondary">
- {i18n.t("number_online", { count: this.props.online })}
+ {i18n.t("number_online", {
+ count: this.props.online,
+ formattedCount: numToSI(this.props.online),
+ })}
</li>
<li
className="list-inline-item badge badge-secondary pointer"
data-tippy-content={`${i18n.t("number_of_users", {
count: counts.users_active_day,
+ formattedCount: counts.users_active_day,
})} ${i18n.t("active_in_the_last")} ${i18n.t("day")}`}
>
{i18n.t("number_of_users", {
count: counts.users_active_day,
+ formattedCount: numToSI(counts.users_active_day),
})}{" "}
/ {i18n.t("day")}
</li>
className="list-inline-item badge badge-secondary pointer"
data-tippy-content={`${i18n.t("number_of_users", {
count: counts.users_active_week,
+ formattedCount: counts.users_active_week,
})} ${i18n.t("active_in_the_last")} ${i18n.t("week")}`}
>
{i18n.t("number_of_users", {
count: counts.users_active_week,
+ formattedCount: numToSI(counts.users_active_week),
})}{" "}
/ {i18n.t("week")}
</li>
className="list-inline-item badge badge-secondary pointer"
data-tippy-content={`${i18n.t("number_of_users", {
count: counts.users_active_month,
+ formattedCount: counts.users_active_month,
})} ${i18n.t("active_in_the_last")} ${i18n.t("month")}`}
>
{i18n.t("number_of_users", {
count: counts.users_active_month,
+ formattedCount: numToSI(counts.users_active_month),
})}{" "}
/ {i18n.t("month")}
</li>
className="list-inline-item badge badge-secondary pointer"
data-tippy-content={`${i18n.t("number_of_users", {
count: counts.users_active_half_year,
+ formattedCount: counts.users_active_half_year,
})} ${i18n.t("active_in_the_last")} ${i18n.t("number_of_months", {
count: 6,
+ formattedCount: 6,
})}`}
>
{i18n.t("number_of_users", {
count: counts.users_active_half_year,
+ formattedCount: numToSI(counts.users_active_half_year),
})}{" "}
- / {i18n.t("number_of_months", { count: 6 })}
+ / {i18n.t("number_of_months", { count: 6, formattedCount: 6 })}
</li>
<li className="list-inline-item badge badge-secondary">
{i18n.t("number_of_subscribers", {
count: counts.subscribers,
+ formattedCount: numToSI(counts.subscribers),
})}
</li>
<li className="list-inline-item badge badge-secondary">
{i18n.t("number_of_posts", {
count: counts.posts,
+ formattedCount: numToSI(counts.posts),
})}
</li>
<li className="list-inline-item badge badge-secondary">
{i18n.t("number_of_comments", {
count: counts.comments,
+ formattedCount: numToSI(counts.comments),
})}
</li>
<li className="list-inline-item">
getSortTypeFromProps,
mdToHtml,
notifyPost,
+ numToSI,
restoreScrollPosition,
saveCommentRes,
saveScrollPosition,
return (
<ul class="my-2 list-inline">
<li className="list-inline-item badge badge-secondary">
- {i18n.t("number_online", { count: this.state.siteRes.online })}
+ {i18n.t("number_online", {
+ count: this.state.siteRes.online,
+ formattedCount: numToSI(this.state.siteRes.online),
+ })}
</li>
<li
className="list-inline-item badge badge-secondary pointer"
data-tippy-content={`${i18n.t("number_of_users", {
count: counts.users_active_day,
+ formattedCount: counts.users_active_day,
})} ${i18n.t("active_in_the_last")} ${i18n.t("day")}`}
>
{i18n.t("number_of_users", {
count: counts.users_active_day,
+ formattedCount: numToSI(counts.users_active_day),
})}{" "}
/ {i18n.t("day")}
</li>
className="list-inline-item badge badge-secondary pointer"
data-tippy-content={`${i18n.t("number_of_users", {
count: counts.users_active_week,
+ formattedCount: counts.users_active_week,
})} ${i18n.t("active_in_the_last")} ${i18n.t("week")}`}
>
{i18n.t("number_of_users", {
count: counts.users_active_week,
+ formattedCount: numToSI(counts.users_active_week),
})}{" "}
/ {i18n.t("week")}
</li>
className="list-inline-item badge badge-secondary pointer"
data-tippy-content={`${i18n.t("number_of_users", {
count: counts.users_active_month,
+ formattedCount: counts.users_active_month,
})} ${i18n.t("active_in_the_last")} ${i18n.t("month")}`}
>
{i18n.t("number_of_users", {
count: counts.users_active_month,
+ formattedCount: numToSI(counts.users_active_month),
})}{" "}
/ {i18n.t("month")}
</li>
className="list-inline-item badge badge-secondary pointer"
data-tippy-content={`${i18n.t("number_of_users", {
count: counts.users_active_half_year,
+ formattedCount: counts.users_active_half_year,
})} ${i18n.t("active_in_the_last")} ${i18n.t("number_of_months", {
count: 6,
+ formattedCount: 6,
})}`}
>
{i18n.t("number_of_users", {
count: counts.users_active_half_year,
+ formattedCount: numToSI(counts.users_active_half_year),
})}{" "}
- / {i18n.t("number_of_months", { count: 6 })}
+ / {i18n.t("number_of_months", { count: 6, formattedCount: 6 })}
</li>
<li className="list-inline-item badge badge-secondary">
{i18n.t("number_of_users", {
count: counts.users,
+ formattedCount: numToSI(counts.users),
})}
</li>
<li className="list-inline-item badge badge-secondary">
{i18n.t("number_of_communities", {
count: counts.communities,
+ formattedCount: numToSI(counts.communities),
})}
</li>
<li className="list-inline-item badge badge-secondary">
{i18n.t("number_of_posts", {
count: counts.posts,
+ formattedCount: numToSI(counts.posts),
})}
</li>
<li className="list-inline-item badge badge-secondary">
{i18n.t("number_of_comments", {
count: counts.comments,
+ formattedCount: numToSI(counts.comments),
})}
</li>
<li className="list-inline-item">
fetchLimit,
getUsernameFromProps,
mdToHtml,
+ numToSI,
previewLines,
restoreScrollPosition,
routeSortTypeToEnum,
<div>
<ul class="list-inline mb-2">
<li className="list-inline-item badge badge-light">
- {i18n.t("number_of_posts", { count: pv.counts.post_count })}
+ {i18n.t("number_of_posts", {
+ count: pv.counts.post_count,
+ formattedCount: numToSI(pv.counts.post_count),
+ })}
</li>
<li className="list-inline-item badge badge-light">
{i18n.t("number_of_comments", {
count: pv.counts.comment_count,
+ formattedCount: numToSI(pv.counts.comment_count),
})}
</li>
</ul>
isVideo,
md,
mdToHtml,
+ numToSI,
previewLines,
setupTippy,
showScores,
class={`unselectable pointer font-weight-bold text-muted px-1`}
data-tippy-content={this.pointsTippy}
>
- {this.state.score}
+ {numToSI(this.state.score)}
</div>
) : (
<div class="p-1"></div>
className="text-muted small"
title={i18n.t("number_of_comments", {
count: post_view.counts.comments,
+ formattedCount: post_view.counts.comments,
})}
to={`/post/${post_view.post.id}?scrollToComments=true`}
>
<Icon icon="message-square" classes="icon-inline mr-1" />
{i18n.t("number_of_comments", {
count: post_view.counts.comments,
+ formattedCount: numToSI(post_view.counts.comments),
})}
</Link>
</button>
>
<small>
<Icon icon="arrow-down1" classes="icon-inline mr-1" />
- <span>{this.state.downvotes}</span>
+ <span>{numToSI(this.state.downvotes)}</span>
</small>
</button>
)}
aria-label={i18n.t("upvote")}
>
<Icon icon="arrow-up1" classes="icon-inline small mr-2" />
- {this.state.upvotes}
+ {numToSI(this.state.upvotes)}
</button>
) : (
<button
>
<Icon icon="arrow-down1" classes="icon-inline small mr-2" />
{this.state.downvotes !== 0 && (
- <span>{this.state.downvotes}</span>
+ <span>{numToSI(this.state.downvotes)}</span>
)}
</button>
) : (
get pointsTippy(): string {
let points = i18n.t("number_of_points", {
count: this.state.score,
+ formattedCount: this.state.score,
});
let upvotes = i18n.t("number_of_upvotes", {
count: this.state.upvotes,
+ formattedCount: this.state.upvotes,
});
let downvotes = i18n.t("number_of_downvotes", {
count: this.state.downvotes,
+ formattedCount: this.state.downvotes,
});
return `${points} • ${upvotes} • ${downvotes}`;
fetchLimit,
fetchUsers,
isBrowser,
+ numToSI,
personSelectName,
personToChoice,
restoreScrollPosition,
<span>{` -
${i18n.t("number_of_subscribers", {
count: community_view.counts.subscribers,
+ formattedCount: numToSI(community_view.counts.subscribers),
})}
`}</span>
</>
</span>,
<span>{` - ${i18n.t("number_of_comments", {
count: person_view.counts.comment_count,
+ formattedCount: numToSI(person_view.counts.comment_count),
})}`}</span>,
];
}
compactDisplay: "short",
});
-export function numToSI(value: any) {
+export function numToSI(value: number): string {
return SHORTNUM_SI_FORMAT.format(value);
}