Localize sync server error codes

This commit is contained in:
mirivlad 2026-07-17 05:09:59 +08:00
parent 126d90cd68
commit 1bcad23b58
3 changed files with 23 additions and 0 deletions

View File

@ -31,6 +31,9 @@
function reportError(key, fallback, error) { function reportError(key, fallback, error) {
console.warn('[verstak.sync] operation failed:', error) console.warn('[verstak.sync] operation failed:', error)
const code = String(error?.message || error || '').match(/sync-server:([a-z_]+)/)?.[1]
const localized = code ? tr(`ui.serverError.${code}`, null, '') : ''
if (localized && localized !== `ui.serverError.${code}`) return localized
return tr(key, null, fallback) return tr(key, null, fallback)
} }

View File

@ -48,4 +48,14 @@
"ui.status.disabled": "Not configured", "ui.status.disabled": "Not configured",
"ui.status.error": "Error", "ui.status.error": "Error",
"ui.status.revoked": "Revoked" "ui.status.revoked": "Revoked"
,"ui.serverError.rate_limited": "Too many attempts. Wait a little and try again."
,"ui.serverError.request_too_large": "The synchronization request is too large."
,"ui.serverError.payload_too_large": "A file operation is too large to send inline."
,"ui.serverError.too_many_operations": "Too many pending changes were sent at once. Try synchronization again."
,"ui.serverError.blob_too_large": "This file exceeds the server blob size limit."
,"ui.serverError.quota_exceeded": "The server storage quota for this vault has been reached."
,"ui.serverError.blob_not_owned": "The file data must be uploaded before it can be synchronized."
,"ui.serverError.blob_not_found": "The required file data is unavailable on the server."
,"ui.serverError.unauthorized": "This device is no longer authorized. Connect it again."
,"ui.serverError.forbidden": "The server denied this synchronization request."
} }

View File

@ -48,4 +48,14 @@
"ui.status.disabled": "Не настроено", "ui.status.disabled": "Не настроено",
"ui.status.error": "Ошибка", "ui.status.error": "Ошибка",
"ui.status.revoked": "Доступ отозван" "ui.status.revoked": "Доступ отозван"
,"ui.serverError.rate_limited": "Слишком много попыток. Подождите и повторите попытку."
,"ui.serverError.request_too_large": "Запрос синхронизации слишком велик."
,"ui.serverError.payload_too_large": "Операция с файлом слишком велика для отправки в этом виде."
,"ui.serverError.too_many_operations": "Одновременно отправлено слишком много изменений. Повторите синхронизацию."
,"ui.serverError.blob_too_large": "Размер файла превышает разрешённый сервером лимит."
,"ui.serverError.quota_exceeded": "Достигнута квота серверного хранилища для этого vault."
,"ui.serverError.blob_not_owned": "Данные файла должны быть загружены до синхронизации операции."
,"ui.serverError.blob_not_found": "Необходимые данные файла недоступны на сервере."
,"ui.serverError.unauthorized": "Устройство больше не авторизовано. Подключите его заново."
,"ui.serverError.forbidden": "Сервер отклонил этот запрос синхронизации."
} }