mirror of
https://github.com/fluxerapp/fluxer
synced 2026-10-18 05:25:40 +09:00
fix(i18n): review translations and fix i18n library misuse (#2750)
This commit is contained in:
1 parent
78f783f0c4
commit
8cb097f954
575 files changed
+192671
-160540
No files matched your search
@@ -42,7 +42,7 @@ const SEARCH_FOR_CHANNELS_PEOPLE_OR_COMMUNITIES_DESCRIPTOR = msg({
|
||||
comment: 'Placeholder text in the mobile quick switcher search input.',
|
||||
});
|
||||
const SEARCHING_PEOPLE_DESCRIPTOR = msg({
|
||||
message: 'Searching people...',
|
||||
message: 'Searching for people...',
|
||||
comment: 'Loading state shown while the quick switcher fetches matching people. Trailing ellipsis is intentional.',
|
||||
});
|
||||
const NO_MATCHES_FOUND_DESCRIPTOR = msg({
|
||||
@@ -54,7 +54,7 @@ const MESSAGE_1_RESULT_AVAILABLE_DESCRIPTOR = msg({
|
||||
comment: 'Screen-reader live region announcement when exactly one quick switcher result is available.',
|
||||
});
|
||||
const RESULTS_AVAILABLE_DESCRIPTOR = msg({
|
||||
message: '{resultCount} results available',
|
||||
message: '{resultCount, plural, one {# result available} other {# results available}}',
|
||||
comment: 'Screen-reader live region announcement listing the quick switcher result count.',
|
||||
});
|
||||
const NO_AUTOCOMPLETE_SUGGESTION_DESCRIPTOR = msg({
|
||||
|
||||
@@ -60,7 +60,7 @@ const AUTOCOMPLETE_SUGGESTION_DESCRIPTOR = msg({
|
||||
comment: 'Screen-reader announcement for the highlighted autocomplete suggestion, without query echo.',
|
||||
});
|
||||
const SEARCHING_PEOPLE_DESCRIPTOR = msg({
|
||||
message: 'Searching people...',
|
||||
message: 'Searching for people...',
|
||||
comment:
|
||||
'Loading state in the desktop quick switcher while fetching people results. Trailing ellipsis is intentional.',
|
||||
});
|
||||
@@ -73,7 +73,7 @@ const MESSAGE_1_RESULT_AVAILABLE_DESCRIPTOR = msg({
|
||||
comment: 'Screen-reader live region announcement when exactly one quick switcher result is available.',
|
||||
});
|
||||
const RESULTS_AVAILABLE_DESCRIPTOR = msg({
|
||||
message: '{resultCount} results available',
|
||||
message: '{resultCount, plural, one {# result available} other {# results available}}',
|
||||
comment: 'Screen-reader live region announcement listing the quick switcher result count.',
|
||||
});
|
||||
const QUICK_SWITCHER_DESCRIPTOR = msg({
|
||||
|
||||
@@ -66,14 +66,9 @@ const MESSAGE_1_MENTION_DESCRIPTOR = msg({
|
||||
message: '1 mention',
|
||||
comment: 'Badge text on a quick switcher row when the channel has exactly one mention.',
|
||||
});
|
||||
const MESSAGE_1_UNREAD_DESCRIPTOR = msg({
|
||||
message: '1 unread',
|
||||
comment: 'Badge text on a quick switcher row when the channel has exactly one unread message.',
|
||||
});
|
||||
const UNREAD_DESCRIPTOR = msg({
|
||||
message: '{unreadCount} unread',
|
||||
comment:
|
||||
'Badge text on a quick switcher row when the channel has multiple unread messages. unreadCount is the count.',
|
||||
message: '{unreadCount, plural, one {# unread} other {# unread}}',
|
||||
comment: 'Badge text on a quick switcher row when the channel has unread messages. unreadCount is the integer count.',
|
||||
});
|
||||
|
||||
export interface QuickSwitcherSection {
|
||||
@@ -299,7 +294,7 @@ export function getQuickSwitcherResultAccessibilityMetadata(
|
||||
);
|
||||
}
|
||||
if (unreadCount > 0) {
|
||||
labelParts.push(unreadCount === 1 ? i18n._(MESSAGE_1_UNREAD_DESCRIPTOR) : i18n._(UNREAD_DESCRIPTOR, {unreadCount}));
|
||||
labelParts.push(i18n._(UNREAD_DESCRIPTOR, {unreadCount}));
|
||||
}
|
||||
return {
|
||||
guildName,
|
||||
|
||||
@@ -22,74 +22,38 @@ const STILL_INDEXING_DESCRIPTOR = msg({
|
||||
comment:
|
||||
'Status message returned by search when results are unavailable because the server is still building the index.',
|
||||
});
|
||||
const VALUE_LINK_LABEL_DESCRIPTOR = msg({
|
||||
message: 'link',
|
||||
comment: 'has:link chip label. Always lowercase; matches the typed query value 1:1.',
|
||||
});
|
||||
const VALUE_LINK_DESCRIPTION_DESCRIPTOR = msg({
|
||||
message: 'a URL typed in the message text',
|
||||
comment: 'Description for has:link. Sentence case, no trailing punctuation.',
|
||||
});
|
||||
const VALUE_EMBED_LABEL_DESCRIPTOR = msg({
|
||||
message: 'embed',
|
||||
comment: 'has:embed chip label. Always lowercase; matches the typed query value 1:1.',
|
||||
});
|
||||
const VALUE_EMBED_DESCRIPTION_DESCRIPTOR = msg({
|
||||
message: 'a rich embed or link preview (not an uploaded file)',
|
||||
comment: 'Description for has:embed. Sentence case, no trailing punctuation.',
|
||||
});
|
||||
const VALUE_FILE_LABEL_DESCRIPTOR = msg({
|
||||
message: 'file',
|
||||
comment: 'has:file chip label. Always lowercase; matches the typed query value 1:1.',
|
||||
});
|
||||
const VALUE_FILE_DESCRIPTION_DESCRIPTOR = msg({
|
||||
message: 'any uploaded attachment',
|
||||
comment: 'Description for has:file. Sentence case, no trailing punctuation.',
|
||||
});
|
||||
const VALUE_IMAGE_LABEL_DESCRIPTOR = msg({
|
||||
message: 'image',
|
||||
comment: 'has:image chip label. Always lowercase; matches the typed query value 1:1.',
|
||||
});
|
||||
const VALUE_IMAGE_DESCRIPTION_DESCRIPTOR = msg({
|
||||
message: 'an uploaded image file',
|
||||
comment: 'Description for has:image. Sentence case, no trailing punctuation.',
|
||||
});
|
||||
const VALUE_VIDEO_LABEL_DESCRIPTOR = msg({
|
||||
message: 'video',
|
||||
comment: 'has:video chip label. Always lowercase; matches the typed query value 1:1.',
|
||||
});
|
||||
const VALUE_VIDEO_DESCRIPTION_DESCRIPTOR = msg({
|
||||
message: 'an uploaded video file',
|
||||
comment: 'Description for has:video. Sentence case, no trailing punctuation.',
|
||||
});
|
||||
const VALUE_SOUND_LABEL_DESCRIPTOR = msg({
|
||||
message: 'sound',
|
||||
comment: 'has:sound chip label. Always lowercase; matches the typed query value 1:1.',
|
||||
});
|
||||
const VALUE_SOUND_DESCRIPTION_DESCRIPTOR = msg({
|
||||
message: 'an uploaded audio file',
|
||||
comment: 'Description for has:sound. Sentence case, no trailing punctuation.',
|
||||
});
|
||||
const VALUE_STICKER_LABEL_DESCRIPTOR = msg({
|
||||
message: 'sticker',
|
||||
comment: 'has:sticker chip label. Always lowercase; matches the typed query value 1:1.',
|
||||
});
|
||||
const VALUE_STICKER_DESCRIPTION_DESCRIPTOR = msg({
|
||||
message: 'a sticker',
|
||||
comment: 'Description for has:sticker. Sentence case, no trailing punctuation.',
|
||||
});
|
||||
const VALUE_POLL_LABEL_DESCRIPTOR = msg({
|
||||
message: 'poll',
|
||||
comment: 'has:poll chip label. Always lowercase; matches the typed query value 1:1.',
|
||||
});
|
||||
const VALUE_POLL_DESCRIPTION_DESCRIPTOR = msg({
|
||||
message: 'a poll',
|
||||
comment: 'Description for has:poll. Sentence case, no trailing punctuation.',
|
||||
});
|
||||
const VALUE_FORWARD_LABEL_DESCRIPTOR = msg({
|
||||
message: 'forward',
|
||||
comment: 'has:forward chip label. Always lowercase; matches the typed query value 1:1.',
|
||||
});
|
||||
const VALUE_FORWARD_DESCRIPTION_DESCRIPTOR = msg({
|
||||
message: 'a forwarded message',
|
||||
comment: 'Description for has:forward. Sentence case, no trailing punctuation.',
|
||||
@@ -102,12 +66,8 @@ const HINT_EXCLUDE_USER_DESCRIPTOR = msg({
|
||||
message: 'exclude a user',
|
||||
comment: 'Hint shown beside -from: and -mentions: (negation). Sentence case, no trailing punctuation.',
|
||||
});
|
||||
const HINT_HAS_VALUES_DESCRIPTOR = msg({
|
||||
message: 'link, embed, image, video, sound, file, sticker, poll, or forward',
|
||||
comment: 'Hint shown beside has:. Lists all supported content categories in lowercase.',
|
||||
});
|
||||
const HINT_EXCLUDE_HAS_VALUES_DESCRIPTOR = msg({
|
||||
message: 'exclude link, embed, image, video, sound, file, sticker, poll, or forward',
|
||||
message: 'exclude {values}',
|
||||
comment: 'Hint shown beside -has: (negation). Lists all supported content categories in lowercase.',
|
||||
});
|
||||
const HINT_DATE_DESCRIPTOR = msg({
|
||||
@@ -122,14 +82,6 @@ const HINT_EXCLUDE_CHANNEL_DESCRIPTOR = msg({
|
||||
message: 'exclude a channel',
|
||||
comment: 'Hint shown beside -in: (negation). Sentence case, no trailing punctuation.',
|
||||
});
|
||||
const HINT_TRUE_OR_FALSE_DESCRIPTOR = msg({
|
||||
message: 'true or false',
|
||||
comment: 'Hint shown beside pinned:. Lowercase boolean values.',
|
||||
});
|
||||
const HINT_AUTHOR_TYPE_DESCRIPTOR = msg({
|
||||
message: 'user, bot, or webhook',
|
||||
comment: 'Hint shown beside author-type:. Lowercase categories.',
|
||||
});
|
||||
const HINT_LINK_HOSTNAME_DESCRIPTOR = msg({
|
||||
message: 'a hostname, e.g. {exampleDomain}',
|
||||
comment: 'Hint shown beside link: with an example domain. Sentence case, no trailing punctuation.',
|
||||
@@ -154,14 +106,6 @@ const HINT_EXCLUDE_EXT_DESCRIPTOR = msg({
|
||||
message: 'exclude a file extension, e.g. png',
|
||||
comment: 'Hint shown beside -ext: (negation). Sentence case, no trailing punctuation.',
|
||||
});
|
||||
const HINT_SORT_DESCRIPTOR = msg({
|
||||
message: 'timestamp or relevance',
|
||||
comment: 'Hint shown beside sort:. Lowercase values.',
|
||||
});
|
||||
const HINT_ORDER_DESCRIPTOR = msg({
|
||||
message: 'asc or desc',
|
||||
comment: 'Hint shown beside order:. Lowercase values.',
|
||||
});
|
||||
|
||||
export interface SearchOption {
|
||||
value: string;
|
||||
@@ -303,53 +247,55 @@ export interface SearchFilterOption {
|
||||
}
|
||||
|
||||
export function getSearchFilterOptions(i18n: I18n): Array<SearchFilterOption> {
|
||||
const valuesListFormatter = new Intl.ListFormat(i18n.locale, {type: 'disjunction'});
|
||||
const hasContentValues: Array<SearchValueOption> = [
|
||||
{
|
||||
value: 'image',
|
||||
label: i18n._(VALUE_IMAGE_LABEL_DESCRIPTOR),
|
||||
label: 'image',
|
||||
description: i18n._(VALUE_IMAGE_DESCRIPTION_DESCRIPTOR),
|
||||
},
|
||||
{
|
||||
value: 'video',
|
||||
label: i18n._(VALUE_VIDEO_LABEL_DESCRIPTOR),
|
||||
label: 'video',
|
||||
description: i18n._(VALUE_VIDEO_DESCRIPTION_DESCRIPTOR),
|
||||
},
|
||||
{
|
||||
value: 'link',
|
||||
label: i18n._(VALUE_LINK_LABEL_DESCRIPTOR),
|
||||
label: 'link',
|
||||
description: i18n._(VALUE_LINK_DESCRIPTION_DESCRIPTOR),
|
||||
},
|
||||
{
|
||||
value: 'file',
|
||||
label: i18n._(VALUE_FILE_LABEL_DESCRIPTOR),
|
||||
label: 'file',
|
||||
description: i18n._(VALUE_FILE_DESCRIPTION_DESCRIPTOR),
|
||||
},
|
||||
{
|
||||
value: 'embed',
|
||||
label: i18n._(VALUE_EMBED_LABEL_DESCRIPTOR),
|
||||
label: 'embed',
|
||||
description: i18n._(VALUE_EMBED_DESCRIPTION_DESCRIPTOR),
|
||||
},
|
||||
{
|
||||
value: 'sound',
|
||||
label: i18n._(VALUE_SOUND_LABEL_DESCRIPTOR),
|
||||
label: 'sound',
|
||||
description: i18n._(VALUE_SOUND_DESCRIPTION_DESCRIPTOR),
|
||||
},
|
||||
{
|
||||
value: 'poll',
|
||||
label: i18n._(VALUE_POLL_LABEL_DESCRIPTOR),
|
||||
label: 'poll',
|
||||
description: i18n._(VALUE_POLL_DESCRIPTION_DESCRIPTOR),
|
||||
},
|
||||
{
|
||||
value: 'sticker',
|
||||
label: i18n._(VALUE_STICKER_LABEL_DESCRIPTOR),
|
||||
label: 'sticker',
|
||||
description: i18n._(VALUE_STICKER_DESCRIPTION_DESCRIPTOR),
|
||||
},
|
||||
{
|
||||
value: 'forward',
|
||||
label: i18n._(VALUE_FORWARD_LABEL_DESCRIPTOR),
|
||||
label: 'forward',
|
||||
description: i18n._(VALUE_FORWARD_DESCRIPTION_DESCRIPTOR),
|
||||
},
|
||||
];
|
||||
const contentValuesLabel = valuesListFormatter.format(hasContentValues.map(({value}) => value));
|
||||
return [
|
||||
{
|
||||
key: 'from',
|
||||
@@ -382,14 +328,14 @@ export function getSearchFilterOptions(i18n: I18n): Array<SearchFilterOption> {
|
||||
{
|
||||
key: 'has',
|
||||
label: 'has:',
|
||||
description: i18n._(HINT_HAS_VALUES_DESCRIPTOR),
|
||||
description: contentValuesLabel,
|
||||
syntax: 'has:',
|
||||
values: hasContentValues,
|
||||
},
|
||||
{
|
||||
key: '-has',
|
||||
label: '-has:',
|
||||
description: i18n._(HINT_EXCLUDE_HAS_VALUES_DESCRIPTOR),
|
||||
description: i18n._(HINT_EXCLUDE_HAS_VALUES_DESCRIPTOR, {values: contentValuesLabel}),
|
||||
syntax: '-has:',
|
||||
values: hasContentValues,
|
||||
},
|
||||
@@ -442,7 +388,7 @@ export function getSearchFilterOptions(i18n: I18n): Array<SearchFilterOption> {
|
||||
{
|
||||
key: 'pinned',
|
||||
label: 'pinned:',
|
||||
description: i18n._(HINT_TRUE_OR_FALSE_DESCRIPTOR),
|
||||
description: valuesListFormatter.format(['true', 'false']),
|
||||
syntax: 'pinned:',
|
||||
values: [
|
||||
{value: 'true', label: 'true'},
|
||||
@@ -452,7 +398,7 @@ export function getSearchFilterOptions(i18n: I18n): Array<SearchFilterOption> {
|
||||
{
|
||||
key: 'authorType',
|
||||
label: 'author-type:',
|
||||
description: i18n._(HINT_AUTHOR_TYPE_DESCRIPTOR),
|
||||
description: valuesListFormatter.format(['user', 'bot', 'webhook']),
|
||||
syntax: 'author-type:',
|
||||
values: [
|
||||
{value: 'user', label: 'user'},
|
||||
@@ -505,7 +451,7 @@ export function getSearchFilterOptions(i18n: I18n): Array<SearchFilterOption> {
|
||||
{
|
||||
key: 'sort',
|
||||
label: 'sort:',
|
||||
description: i18n._(HINT_SORT_DESCRIPTOR),
|
||||
description: valuesListFormatter.format(['timestamp', 'relevance']),
|
||||
syntax: 'sort:',
|
||||
values: [
|
||||
{value: 'timestamp', label: 'timestamp', isDefault: true},
|
||||
@@ -515,7 +461,7 @@ export function getSearchFilterOptions(i18n: I18n): Array<SearchFilterOption> {
|
||||
{
|
||||
key: 'order',
|
||||
label: 'order:',
|
||||
description: i18n._(HINT_ORDER_DESCRIPTOR),
|
||||
description: valuesListFormatter.format(['asc', 'desc']),
|
||||
syntax: 'order:',
|
||||
values: [
|
||||
{value: 'desc', label: 'desc', isDefault: true},
|
||||
|
||||
Reference in new issue
Block a user