30 [[nodiscard]]
ssize_t plurality(
long long n,
ssize_t max)
const noexcept {
33 r = plurality_func(narrow_cast<int>(n % 1'000'000));
36 r =
static_cast<int>(n == 1);
38 return std::clamp(narrow_cast<ssize_t>(r),
ssize_t{0}, max - 1);
46 ttlet lock = std::scoped_lock(static_mutex);
48 ttlet i = languages.
find(tag);
49 if (i != languages.
end()) {
50 return i->second.get();
58 ttlet lock = std::scoped_lock(static_mutex);
62 auto tmp = std::make_unique<language>(tag);
77 for (ttlet &tag: tags) {
78 ttlet short_tag = tag.short_tag();
80 if (prev_short_tag && short_tag != prev_short_tag) {
90 prev_short_tag = short_tag;
103 ttlet lock = std::scoped_lock(static_mutex);
110 if (compare_then_assign(preferred_languages, tmp)) {
112 for (ttlet &language : tmp) {
113 if (language_order_string.size() != 0) {
114 language_order_string +=
", ";
116 language_order_string +=
to_string(language->tag);
118 tt_log_info(
"Setting preferred language in order: ", language_order_string);
static std::vector< language_tag > add_short_names(std::vector< language_tag > tags) noexcept
Add short language names to the list of names.
Definition language.hpp:72