Fix wrong pluralization usage

Instead of one, should use _1 because string for "one" has to be shown regardless of plural forms

When 1, "{account} followed you" must show instead of "1 people followed you".
Some languages don't have plural rule for "one" so it might not show up. _1 forces it to show.
This commit is contained in:
Lim Chee Aun 2024-08-14 09:40:39 +08:00
parent 4918027c90
commit 2c050c650b
3 changed files with 22 additions and 16 deletions

View file

@ -82,10 +82,10 @@ const contentText = {
}) => ( }) => (
<Plural <Plural
value={count} value={count}
one={ _1={
<Plural <Plural
value={postsCount} value={postsCount}
one={ _1={
<Select <Select
value={postType} value={postType}
_reply={<Trans>{account} boosted your reply.</Trans>} _reply={<Trans>{account} boosted your reply.</Trans>}
@ -125,7 +125,7 @@ const contentText = {
follow: ({ account, count, components: { Subject } }) => ( follow: ({ account, count, components: { Subject } }) => (
<Plural <Plural
value={count} value={count}
one={<Trans>{account} followed you.</Trans>} _1={<Trans>{account} followed you.</Trans>}
other={ other={
<Trans> <Trans>
<Subject clickable={count > 1}> <Subject clickable={count > 1}>
@ -148,10 +148,10 @@ const contentText = {
}) => ( }) => (
<Plural <Plural
value={count} value={count}
one={ _1={
<Plural <Plural
value={postsCount} value={postsCount}
one={ _1={
<Select <Select
value={postType} value={postType}
_reply={<Trans>{account} liked your reply.</Trans>} _reply={<Trans>{account} liked your reply.</Trans>}
@ -201,10 +201,10 @@ const contentText = {
}) => ( }) => (
<Plural <Plural
value={count} value={count}
one={ _1={
<Plural <Plural
value={postsCount} value={postsCount}
one={ _1={
<Select <Select
value={postType} value={postType}
_reply={<Trans>{account} boosted & liked your reply.</Trans>} _reply={<Trans>{account} boosted & liked your reply.</Trans>}
@ -402,7 +402,13 @@ function Notification({
text = text({ emoji: notification.emoji, emojiURL }); text = text({ emoji: notification.emoji, emojiURL });
} else { } else {
text = text({ text = text({
account: account && <NameText account={account} showAvatar />, account: account ? (
<NameText account={account} showAvatar />
) : (
sampleAccounts?.[0] && (
<NameText account={sampleAccounts[0]} showAvatar />
)
),
count, count,
postsCount, postsCount,
postType: isReplyToOthers ? 'reply' : 'post', postType: isReplyToOthers ? 'reply' : 'post',

View file

@ -1343,11 +1343,11 @@ msgid "{account} published a post."
msgstr "" msgstr ""
#: src/components/notification.jsx:83 #: src/components/notification.jsx:83
msgid "{count, plural, one {{postsCount, plural, one {{postType, select, reply {{account} boosted your reply.} other {{account} boosted your post.}}} other {{account} boosted {postsCount} of your posts.}}} other {{postType, select, reply {<0><1>{0}</1> people</0> boosted your reply.} other {<2><3>{1}</3> people</2> boosted your post.}}}}" msgid "{count, plural, =1 {{postsCount, plural, =1 {{postType, select, reply {{account} boosted your reply.} other {{account} boosted your post.}}} other {{account} boosted {postsCount} of your posts.}}} other {{postType, select, reply {<0><1>{0}</1> people</0> boosted your reply.} other {<2><3>{1}</3> people</2> boosted your post.}}}}"
msgstr "" msgstr ""
#: src/components/notification.jsx:126 #: src/components/notification.jsx:126
msgid "{count, plural, one {{account} followed you.} other {<0><1>{0}</1> people</0> followed you.}}" msgid "{count, plural, =1 {{account} followed you.} other {<0><1>{0}</1> people</0> followed you.}}"
msgstr "" msgstr ""
#: src/components/notification.jsx:140 #: src/components/notification.jsx:140
@ -1355,7 +1355,7 @@ msgid "{account} requested to follow you."
msgstr "" msgstr ""
#: src/components/notification.jsx:149 #: src/components/notification.jsx:149
msgid "{count, plural, one {{postsCount, plural, one {{postType, select, reply {{account} liked your reply.} other {{account} liked your post.}}} other {{account} liked {postsCount} of your posts.}}} other {{postType, select, reply {<0><1>{0}</1> people</0> liked your reply.} other {<2><3>{1}</3> people</2> liked your post.}}}}" msgid "{count, plural, =1 {{postsCount, plural, =1 {{postType, select, reply {{account} liked your reply.} other {{account} liked your post.}}} other {{account} liked {postsCount} of your posts.}}} other {{postType, select, reply {<0><1>{0}</1> people</0> liked your reply.} other {<2><3>{1}</3> people</2> liked your post.}}}}"
msgstr "" msgstr ""
#: src/components/notification.jsx:191 #: src/components/notification.jsx:191
@ -1375,7 +1375,7 @@ msgid "A post you interacted with has been edited."
msgstr "" msgstr ""
#: src/components/notification.jsx:202 #: src/components/notification.jsx:202
msgid "{count, plural, one {{postsCount, plural, one {{postType, select, reply {{account} boosted & liked your reply.} other {{account} boosted & liked your post.}}} other {{account} boosted & liked {postsCount} of your posts.}}} other {{postType, select, reply {<0><1>{0}</1> people</0> boosted & liked your reply.} other {<2><3>{1}</3> people</2> boosted & liked your post.}}}}" msgid "{count, plural, =1 {{postsCount, plural, =1 {{postType, select, reply {{account} boosted & liked your reply.} other {{account} boosted & liked your post.}}} other {{account} boosted & liked {postsCount} of your posts.}}} other {{postType, select, reply {<0><1>{0}</1> people</0> boosted & liked your reply.} other {<2><3>{1}</3> people</2> boosted & liked your post.}}}}"
msgstr "" msgstr ""
#: src/components/notification.jsx:244 #: src/components/notification.jsx:244

View file

@ -1343,11 +1343,11 @@ msgid "{account} published a post."
msgstr "" msgstr ""
#: src/components/notification.jsx:83 #: src/components/notification.jsx:83
msgid "{count, plural, one {{postsCount, plural, one {{postType, select, reply {{account} boosted your reply.} other {{account} boosted your post.}}} other {{account} boosted {postsCount} of your posts.}}} other {{postType, select, reply {<0><1>{0}</1> people</0> boosted your reply.} other {<2><3>{1}</3> people</2> boosted your post.}}}}" msgid "{count, plural, =1 {{postsCount, plural, =1 {{postType, select, reply {{account} boosted your reply.} other {{account} boosted your post.}}} other {{account} boosted {postsCount} of your posts.}}} other {{postType, select, reply {<0><1>{0}</1> people</0> boosted your reply.} other {<2><3>{1}</3> people</2> boosted your post.}}}}"
msgstr "" msgstr ""
#: src/components/notification.jsx:126 #: src/components/notification.jsx:126
msgid "{count, plural, one {{account} followed you.} other {<0><1>{0}</1> people</0> followed you.}}" msgid "{count, plural, =1 {{account} followed you.} other {<0><1>{0}</1> people</0> followed you.}}"
msgstr "" msgstr ""
#: src/components/notification.jsx:140 #: src/components/notification.jsx:140
@ -1355,7 +1355,7 @@ msgid "{account} requested to follow you."
msgstr "" msgstr ""
#: src/components/notification.jsx:149 #: src/components/notification.jsx:149
msgid "{count, plural, one {{postsCount, plural, one {{postType, select, reply {{account} liked your reply.} other {{account} liked your post.}}} other {{account} liked {postsCount} of your posts.}}} other {{postType, select, reply {<0><1>{0}</1> people</0> liked your reply.} other {<2><3>{1}</3> people</2> liked your post.}}}}" msgid "{count, plural, =1 {{postsCount, plural, =1 {{postType, select, reply {{account} liked your reply.} other {{account} liked your post.}}} other {{account} liked {postsCount} of your posts.}}} other {{postType, select, reply {<0><1>{0}</1> people</0> liked your reply.} other {<2><3>{1}</3> people</2> liked your post.}}}}"
msgstr "" msgstr ""
#: src/components/notification.jsx:191 #: src/components/notification.jsx:191
@ -1375,7 +1375,7 @@ msgid "A post you interacted with has been edited."
msgstr "" msgstr ""
#: src/components/notification.jsx:202 #: src/components/notification.jsx:202
msgid "{count, plural, one {{postsCount, plural, one {{postType, select, reply {{account} boosted & liked your reply.} other {{account} boosted & liked your post.}}} other {{account} boosted & liked {postsCount} of your posts.}}} other {{postType, select, reply {<0><1>{0}</1> people</0> boosted & liked your reply.} other {<2><3>{1}</3> people</2> boosted & liked your post.}}}}" msgid "{count, plural, =1 {{postsCount, plural, =1 {{postType, select, reply {{account} boosted & liked your reply.} other {{account} boosted & liked your post.}}} other {{account} boosted & liked {postsCount} of your posts.}}} other {{postType, select, reply {<0><1>{0}</1> people</0> boosted & liked your reply.} other {<2><3>{1}</3> people</2> boosted & liked your post.}}}}"
msgstr "" msgstr ""
#: src/components/notification.jsx:244 #: src/components/notification.jsx:244