feat(i18n): add i18n to PublishWidgetFull (#872)

This commit is contained in:
Joaquín Sánchez 2023-01-08 13:54:05 +01:00 committed by GitHub
parent 6e0ce3c916
commit 5075fdf194
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 20 additions and 3 deletions

View file

@ -141,6 +141,7 @@ This is the full list of entries that will be available for number formatting in
- `account.followers_count`: `{0}` for formatted number and `{n}` for raw number - **{0} should be use** - `account.followers_count`: `{0}` for formatted number and `{n}` for raw number - **{0} should be use**
- `account.following_count`: `{0}` for formatted number and `{n}` for raw number - **{0} should be use** - `account.following_count`: `{0}` for formatted number and `{n}` for raw number - **{0} should be use**
- `account.posts_count`: `{0}` for formatted number and `{n}` for raw number - **{0} should be use** - `account.posts_count`: `{0}` for formatted number and `{n}` for raw number - **{0} should be use**
- `compose.drafts`: `{v}` for formatted number and `{n}` for raw number - **{v} should be use**
- `notification.followed_you_count`: `{followers}` for formatted number and `{n}` for raw number - **{followers} should be use** - `notification.followed_you_count`: `{followers}` for formatted number and `{n}` for raw number - **{followers} should be use**
- `status.poll.count`: `{0}` for formatted number and `{n}` for raw number - **{0} should be use** - `status.poll.count`: `{0}` for formatted number and `{n}` for raw number - **{0} should be use**
- `time_ago_options.*`: `{0}` for formatted number and `{n}` for raw number - **{0} should be use**: since numbers will be always small, we can also use `{n}` - `time_ago_options.*`: `{0}` for formatted number and `{n}` for raw number - **{0} should be use**: since numbers will be always small, we can also use `{n}`

View file

@ -2,6 +2,8 @@
import { formatTimeAgo } from '@vueuse/core' import { formatTimeAgo } from '@vueuse/core'
const route = useRoute() const route = useRoute()
const { formatNumber } = useHumanReadableNumber()
const timeAgoOptions = useTimeAgoOptions()
let draftKey = $ref('home') let draftKey = $ref('home')
@ -25,7 +27,7 @@ onMounted(() => {
<div text-right h-8> <div text-right h-8>
<VDropdown v-if="nonEmptyDrafts.length" placement="bottom-end"> <VDropdown v-if="nonEmptyDrafts.length" placement="bottom-end">
<button btn-text flex="inline center"> <button btn-text flex="inline center">
Drafts ({{ nonEmptyDrafts.length }}) <div i-ri:arrow-down-s-line /> {{ $t('compose.drafts', nonEmptyDrafts.length, { named: { v: formatNumber(nonEmptyDrafts.length) } }) }}&#160;<div aria-hidden="true" i-ri:arrow-down-s-line />
</button> </button>
<template #popper="{ hide }"> <template #popper="{ hide }">
<div flex="~ col"> <div flex="~ col">
@ -38,9 +40,11 @@ onMounted(() => {
> >
<div> <div>
<div flex="~ gap-1" items-center> <div flex="~ gap-1" items-center>
Draft <code>{{ key }}</code> <i18n-t keypath="compose.draft_title">
<code>{{ key }}</code>
</i18n-t>
<span v-if="draft.lastUpdated" text-secondary text-sm> <span v-if="draft.lastUpdated" text-secondary text-sm>
&middot; {{ formatTimeAgo(new Date(draft.lastUpdated)) }} &middot; {{ formatTimeAgo(new Date(draft.lastUpdated), timeAgoOptions) }}
</span> </span>
</div> </div>
<div text-secondary> <div text-secondary>

View file

@ -88,6 +88,10 @@
"not_found": "404 Not Found", "not_found": "404 Not Found",
"offline_desc": "Seems like you are offline. Please check your network connection." "offline_desc": "Seems like you are offline. Please check your network connection."
}, },
"compose": {
"draft_title": "Draft {0}",
"drafts": "Drafts ({v})"
},
"conversation": { "conversation": {
"with": "with" "with": "with"
}, },

View file

@ -97,6 +97,10 @@
"not_found": "404 Not Found", "not_found": "404 Not Found",
"offline_desc": "Seems like you are offline. Please check your network connection." "offline_desc": "Seems like you are offline. Please check your network connection."
}, },
"compose": {
"draft_title": "Draft {0}",
"drafts": "Drafts ({v})"
},
"conversation": { "conversation": {
"with": "with" "with": "with"
}, },

View file

@ -88,6 +88,10 @@
"not_found": "404 No Encontrado", "not_found": "404 No Encontrado",
"offline_desc": "Al parecer estás fuera de línea. Por favor, comprueba tu conexión a la red." "offline_desc": "Al parecer estás fuera de línea. Por favor, comprueba tu conexión a la red."
}, },
"compose": {
"draft_title": "Borrador {0}",
"drafts": "Borradores ({v})"
},
"conversation": { "conversation": {
"with": "con" "with": "con"
}, },