Skip to content

Commit 3aac6dd

Browse files
committed
fix: use i18n pluralisation
1 parent 38dfe4d commit 3aac6dd

6 files changed

Lines changed: 39 additions & 8 deletions

File tree

app/components/BlueskyComment.vue

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -165,10 +165,10 @@ function getHostname(uri: string): string {
165165
class="mt-2 flex gap-4 text-sm text-fg-subtle"
166166
>
167167
<span v-if="comment.likeCount > 0">
168-
{{ comment.likeCount }} {{ comment.likeCount === 1 ? 'like' : 'likes' }}
168+
{{ $t('blog.atproto.like_count', { count: comment.likeCount }, comment.likeCount) }}
169169
</span>
170170
<span v-if="comment.repostCount > 0">
171-
{{ comment.repostCount }} {{ comment.repostCount === 1 ? 'repost' : 'reposts' }}
171+
{{ $t('blog.atproto.repost_count', { count: comment.repostCount }, comment.repostCount) }}
172172
</span>
173173
</div>
174174

@@ -189,8 +189,13 @@ function getHostname(uri: string): string {
189189
rel="noopener noreferrer"
190190
class="mt-2 block text-sm link"
191191
>
192-
{{ comment.replies.length }} more
193-
{{ comment.replies.length === 1 ? 'reply' : 'replies' }}...
192+
{{
193+
$t(
194+
'blog.atproto.more_replies',
195+
{ count: comment.replies.length },
196+
comment.replies.length,
197+
)
198+
}}
194199
</a>
195200
</template>
196201
</div>

app/components/BlueskyComments.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,9 @@ const postUrl = computed(() => data.value?.postUrl)
9292
<!-- Comments Thread -->
9393
<div v-else class="flex flex-col gap-6">
9494
<div class="flex items-center justify-between gap-4 text-sm text-fg-muted">
95-
<span>{{ thread.replyCount }} {{ thread.replyCount === 1 ? 'reply' : 'replies' }}</span>
95+
<span>{{
96+
$t('blog.atproto.reply_count', { count: thread.replyCount }, thread.replyCount)
97+
}}</span>
9698
<LinkBase v-if="postUrl" variant="button-primary" :to="postUrl">
9799
{{ $t('blog.atproto.reply_on_bluesky') }}
98100
</LinkBase>

i18n/locales/en.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,11 @@
9494
"could_not_load_comments": "Could not load comments.",
9595
"comments": "Comments",
9696
"loading_comments": "Loading comments...",
97-
"updating": "Updating..."
97+
"updating": "Updating...",
98+
"reply_count": "{count} reply | {count} replies",
99+
"like_count": "{count} like | {count} likes",
100+
"repost_count": "{count} repost | {count} reposts",
101+
"more_replies": "{count} more reply... | {count} more replies..."
98102
}
99103
},
100104
"settings": {

i18n/schema.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,18 @@
288288
},
289289
"updating": {
290290
"type": "string"
291+
},
292+
"reply_count": {
293+
"type": "string"
294+
},
295+
"like_count": {
296+
"type": "string"
297+
},
298+
"repost_count": {
299+
"type": "string"
300+
},
301+
"more_replies": {
302+
"type": "string"
291303
}
292304
},
293305
"additionalProperties": false

lunaria/files/en-GB.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,11 @@
9393
"could_not_load_comments": "Could not load comments.",
9494
"comments": "Comments",
9595
"loading_comments": "Loading comments...",
96-
"updating": "Updating..."
96+
"updating": "Updating...",
97+
"reply_count": "{count} reply | {count} replies",
98+
"like_count": "{count} like | {count} likes",
99+
"repost_count": "{count} repost | {count} reposts",
100+
"more_replies": "{count} more reply... | {count} more replies..."
97101
}
98102
},
99103
"settings": {

lunaria/files/en-US.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,11 @@
9393
"could_not_load_comments": "Could not load comments.",
9494
"comments": "Comments",
9595
"loading_comments": "Loading comments...",
96-
"updating": "Updating..."
96+
"updating": "Updating...",
97+
"reply_count": "{count} reply | {count} replies",
98+
"like_count": "{count} like | {count} likes",
99+
"repost_count": "{count} repost | {count} reposts",
100+
"more_replies": "{count} more reply... | {count} more replies..."
97101
}
98102
},
99103
"settings": {

0 commit comments

Comments
 (0)