Skip to content

Commit 1bac254

Browse files
committed
feat: Add internationalization support for error handling and improve error page content
1 parent c3c5710 commit 1bac254

File tree

4 files changed

+63
-5
lines changed

4 files changed

+63
-5
lines changed

apps/client/error.vue

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
11
<script lang="ts" setup>
22
import type { NuxtError } from '#app';
33
4+
const { t } = useI18n();
5+
46
const props = defineProps({
57
error: Object as () => NuxtError
68
});
79
810
const handleClear = () => clearError({ redirect: '/' });
11+
12+
useSeoMeta({
13+
title: t('pages.error.meta.title'),
14+
description: t('pages.error.meta.description', { code: props.error?.statusCode })
15+
});
916
</script>
1017

1118
<style lang="scss">
@@ -22,18 +29,18 @@ const handleClear = () => clearError({ redirect: '/' });
2229
<h1>{{ props.error?.statusCode }}</h1>
2330

2431
<template v-if="props.error?.statusCode === 404">
25-
<h2>Page not found</h2>
32+
<h2>{{ t('pages.error.errors.not_found.title') }}</h2>
2633

27-
<p>Sorry, the page you are looking for does not exist or has been moved.</p>
34+
<p>{{ t('pages.error.errors.not_found.description') }}</p>
2835
</template>
2936
<template v-else>
30-
<h2>Oops! An error occurred.</h2>
37+
<h2>{{ t('pages.error.errors.default.title') }}</h2>
3138

32-
<p>Sorry, an error has occurred on the server.</p>
39+
<p>{{ t('pages.error.errors.default.description') }}</p>
3340
</template>
3441

3542
<Button @click="handleClear" theme="primary" class="mt-8">
36-
<Icon name="material-symbols:arrow-back-rounded" /> Go back
43+
<Icon name="material-symbols:arrow-back-rounded" /> {{ t('pages.error.back') }}
3744
</Button>
3845
</div>
3946

apps/client/i18n/locales/en-US.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,23 @@ export default {
181181
description:
182182
'ZyroHub is a toolkit designed for developers, offering solutions for media conversion and manipulation. It includes a variety of essential tools, eliminating the need to install or rely on multiple software and services to accomplish common tasks.'
183183
},
184+
error: {
185+
meta: {
186+
title: 'Error {code}',
187+
description: 'An error occurred while trying to access the requested page.'
188+
},
189+
back: 'Back to Home',
190+
errors: {
191+
not_found: {
192+
title: 'Page Not Found',
193+
description: 'The page you are trying to access does not exist or is currently unavailable.'
194+
},
195+
default: {
196+
title: 'Oops! An error occurred.',
197+
description: 'Something went wrong while trying to access the requested page.'
198+
}
199+
}
200+
},
184201
home: {
185202
title: 'Welcome to',
186203
description: 'Please select an option below to get started.',

apps/client/i18n/locales/es-ES.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,23 @@ export default {
182182
description:
183183
'ZyroHub es un conjunto de herramientas diseñado para desarrolladores, que ofrece soluciones para la conversión y manipulación de medios. Incluye una variedad de herramientas esenciales, eliminando la necesidad de instalar o depender de múltiples software y servicios para realizar tareas comunes.'
184184
},
185+
error: {
186+
meta: {
187+
title: 'Error {code}',
188+
description: 'Ocurrió un error al intentar acceder a la página solicitada.'
189+
},
190+
back: 'Volver al Inicio',
191+
errors: {
192+
not_found: {
193+
title: 'Página No Encontrada',
194+
description: 'La página que intenta acceder no existe o no está disponible en este momento.'
195+
},
196+
default: {
197+
title: '¡Ocurrió un Error!',
198+
description: 'Algo salió mal al intentar acceder a la página solicitada.'
199+
}
200+
}
201+
},
185202
home: {
186203
title: 'Bienvenido a',
187204
description: 'Seleccione una opción a continuación para comenzar.',

apps/client/i18n/locales/pt-BR.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,23 @@ export default {
182182
description:
183183
'ZyroHub é um toolkit desenhado para desenvolvedores, oferecendo soluções para conversão e manipulação de mídia. Inclui uma variedade de ferramentas essenciais, eliminando a necessidade de instalar ou depender de múltiplos softwares e serviços para realizar tarefas comuns.'
184184
},
185+
error: {
186+
meta: {
187+
title: 'Error {code}',
188+
description: 'Ocorreu um erro ao tentar acessar a página solicitada.'
189+
},
190+
back: 'Voltar para o Início',
191+
errors: {
192+
not_found: {
193+
title: 'Página Não Encontrada',
194+
description: 'A página que você está tentando acessar não existe ou está indisponível no momento.'
195+
},
196+
default: {
197+
title: 'Oops! Um erro ocorreu.',
198+
description: 'Algo deu errado ao tentar acessar a página solicitada.'
199+
}
200+
}
201+
},
185202
home: {
186203
title: 'Bem-Vindo ao',
187204
description: 'Por favor selecione uma das opções abaixo para começar.',

0 commit comments

Comments
 (0)