i18n: extract shared strings into the existing common namespace

Part of #145.

Fourteen files whose user-facing strings are generic enough to belong in
`common` — loading and empty states, the confirmation modal, the shared
input modals (text/date/user/attachment viewer), the mobile nav bar, the
autocomplete input, the error screen and the file-upload error paths.

Extends the namespace that already exists, so `src/i18n/config.js` is
untouched and this cannot collide with any other extraction PR over the
`ns:` array. 28 keys added to `public/locales/en/common.json`.

English only — no translations, no behaviour change. Every t() value is
checked against this branch's base: the string must appear
character-for-character in the code it replaces (36 call sites).

One value is matched loosely and worth naming: `errorScreen.hideDetails`.
The base renders `{showDetails ? 'Hide' : 'Show'} error details`, so
neither full phrase exists contiguously in the source — only one branch of
the ternary can. Both keys hold exactly what each branch renders. The
sentence is kept whole rather than split around the ternary, because a
split sentence cannot be reordered by a translator.
This commit is contained in:
everysingletear
2026-08-13 10:16:14 +08:00
parent 7eba12e718
commit bdac10ac57
15 changed files with 102 additions and 43 deletions

View File

@@ -5,12 +5,14 @@ import { useUserProfile } from '../queries/UserQueries'
import { useNotification } from '../service/NotificationProvider'
import { apiClient } from '../utils/ApiClient'
import { isPlusAccount, resolvePhotoURL } from '../utils/Helpers'
import { useTranslation } from 'react-i18next'
export const useFileUpload = ({
draftId,
entityId,
entityType = 'chore_attachment',
} = {}) => {
const { t } = useTranslation('common')
const { showError } = useNotification()
const { data: userProfile } = useUserProfile()
@@ -58,14 +60,14 @@ export const useFileUpload = ({
if (response.status === 507) {
showError({
title: 'Storage Quota Exceeded',
message: 'You have exceeded your quota for uploading files.',
title: t('upload.quotaTitle'),
message: t('upload.quotaMessage'),
})
return null
} else if (response.status === 413) {
showError({
title: 'File Too Large',
message: 'The file you are trying to upload is too large.',
title: t('upload.tooLargeTitle'),
message: t('upload.tooLargeMessage'),
})
return null
} else if (response.status === 403 && !isPlusAccount(userProfile)) {
@@ -76,8 +78,8 @@ export const useFileUpload = ({
return null
} else if (response.status === 403) {
showError({
title: 'Permission Denied',
message: 'You do not have permission to upload files.',
title: t('upload.deniedTitle'),
message: t('upload.deniedMessage'),
})
return null
} else if (!response.ok) {
@@ -105,7 +107,7 @@ export const useFileUpload = ({
return null
}
},
[entityType, entityId, draftId, showError, userProfile],
[entityType, entityId, draftId, showError, userProfile, t],
)
return { uploadFile, isPlus: isPlusAccount(userProfile) }