From c4cf3fb371dfd8caf7634ace83a783d0727b5c07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joaqu=C3=ADn=20S=C3=A1nchez?= Date: Fri, 2 Dec 2022 03:18:36 +0100 Subject: [PATCH] feat(i18n): plurals support (#278) --- components/account/AccountAvatar.vue | 2 +- components/account/AccountHeader.vue | 13 ++-- components/account/AccountPostsFollowers.vue | 27 +++++++-- components/nav/NavFooter.vue | 17 +++--- .../NotificationGroupedFollow.vue | 21 ++++++- components/status/StatusCard.vue | 1 + components/status/StatusPoll.vue | 3 +- components/status/edit/StatusEditHistory.vue | 3 +- components/timeline/TimelinePaginator.vue | 2 +- composables/numbers.ts | 41 +++++++++++-- composables/time.ts | 54 ++++++++--------- locales/en-US.json | 38 +++++++----- locales/es-ES.json | 36 +++++++---- locales/ja-JP.json | 2 +- locales/zh-CN.json | 4 +- nuxt.config.ts | 59 ++++++++++++++++++- pages/@[account]/index/index.vue | 2 +- 17 files changed, 234 insertions(+), 91 deletions(-) diff --git a/components/account/AccountAvatar.vue b/components/account/AccountAvatar.vue index 08c29fe4..f6310da9 100644 --- a/components/account/AccountAvatar.vue +++ b/components/account/AccountAvatar.vue @@ -12,7 +12,7 @@ const loaded = $ref(false) () +const { t } = useI18n() + const createdAt = $(useFormattedDateTime(() => account.createdAt, { month: 'long', day: 'numeric', @@ -43,13 +45,16 @@ function getFieldNameIcon(fieldName: string) { if (fieldNameIcons[name]) return fieldNameIcons[name] } +function getFieldIconTitle(fieldName: string) { + return fieldName === 'Joined' ? t('account.joined') : fieldName +} function previewHeader() { openMediaPreview([{ id: `${account.acct}:header`, type: 'image', previewUrl: account.header, - description: `${account.username}'s profile header`, + description: t('account.profile_description', [account.username]), }]) } @@ -58,7 +63,7 @@ function previewAvatar() { id: `${account.acct}:avatar`, type: 'image', previewUrl: account.avatar, - description: `${account.username}'s avatar`, + description: t('account.avatar_description', [account.username]), }]) } @@ -86,7 +91,7 @@ watchEffect(() => {