feat(i18n): localize shell and common UI
This commit is contained in:
@@ -86,8 +86,47 @@ test.describe("language switcher", () => {
|
||||
await expect(
|
||||
page.getByRole("heading", { name: "Panel de control" }),
|
||||
).toBeVisible()
|
||||
await expect(page.getByRole("link", { name: /Inicio/ })).toBeVisible()
|
||||
await page.getByRole("button", { name: /Inventario/ }).click()
|
||||
await expect(page.getByRole("link", { name: /Artículos/ })).toBeVisible()
|
||||
await expect(
|
||||
page.getByRole("link", { name: /Destinatarios/ }),
|
||||
).toBeVisible()
|
||||
await expect(page.getByRole("link", { name: /Usuarios/ })).toBeVisible()
|
||||
|
||||
await page.getByRole("button", { name: "Añadir" }).click()
|
||||
await expect(page.getByRole("menuitem", { name: /Importar/ })).toBeVisible()
|
||||
await expect(
|
||||
page.getByRole("menuitem", { name: /Categoría/ }),
|
||||
).toBeVisible()
|
||||
await expect(
|
||||
page.getByRole("menuitem", { name: /Asignación/ }),
|
||||
).toBeVisible()
|
||||
await page.keyboard.press("Escape")
|
||||
|
||||
await expect(page.getByText("E2E Admin")).toBeVisible()
|
||||
await expect(page.getByText("admin@example.test")).toBeVisible()
|
||||
await page.getByText("E2E Admin").click()
|
||||
await expect(page.getByText("Mi cuenta")).toBeVisible()
|
||||
await expect(
|
||||
page.getByRole("button", { name: "Cerrar sesión" }),
|
||||
).toBeVisible()
|
||||
await page.keyboard.press("Escape")
|
||||
|
||||
await page.goto("/admin/users")
|
||||
await expect(page.getByPlaceholder("Buscar...")).toBeVisible()
|
||||
await expect(page.getByRole("searchbox", { name: "Buscar" })).toBeVisible()
|
||||
|
||||
await page.goto("/forbidden")
|
||||
await expect(
|
||||
page.getByRole("heading", { name: "Acceso denegado" }),
|
||||
).toBeVisible()
|
||||
await expect(
|
||||
page.getByText("No tienes permisos para acceder a esta sección."),
|
||||
).toBeVisible()
|
||||
await expect(
|
||||
page.getByRole("link", { name: "Volver al inicio" }),
|
||||
).toBeVisible()
|
||||
|
||||
await expectLocaleCookie(page, "es")
|
||||
})
|
||||
})
|
||||
|
||||
@@ -44,6 +44,113 @@ describe("i18n dictionaries", () => {
|
||||
})
|
||||
})
|
||||
|
||||
it("provides localized shell and common copy for English and Spanish", () => {
|
||||
expect(getDictionary("en").layout).toEqual({
|
||||
sidebar: {
|
||||
home: "Home",
|
||||
inventory: "Inventory",
|
||||
items: "Items",
|
||||
categories: "Categories",
|
||||
assets: "Assets",
|
||||
recipients: "Recipients",
|
||||
movements: "Movements",
|
||||
assignments: "Assignments",
|
||||
users: "Users",
|
||||
},
|
||||
navbar: {
|
||||
accountLabel: "My Account",
|
||||
},
|
||||
addMenu: {
|
||||
add: "Add",
|
||||
import: "Import",
|
||||
category: "Category",
|
||||
item: "Item",
|
||||
asset: "Asset",
|
||||
recipient: "Recipient",
|
||||
assignment: "Assignment",
|
||||
},
|
||||
resetDatabase: {
|
||||
idle: "Reset Database",
|
||||
loading: "Resetting...",
|
||||
successToast: "Database reset successfully",
|
||||
errorToast: "Error resetting database",
|
||||
},
|
||||
logout: {
|
||||
label: "Sign Out",
|
||||
},
|
||||
})
|
||||
|
||||
expect(getDictionary("es").layout).toEqual({
|
||||
sidebar: {
|
||||
home: "Inicio",
|
||||
inventory: "Inventario",
|
||||
items: "Artículos",
|
||||
categories: "Categorías",
|
||||
assets: "Activos",
|
||||
recipients: "Destinatarios",
|
||||
movements: "Movimientos",
|
||||
assignments: "Asignaciones",
|
||||
users: "Usuarios",
|
||||
},
|
||||
navbar: {
|
||||
accountLabel: "Mi cuenta",
|
||||
},
|
||||
addMenu: {
|
||||
add: "Añadir",
|
||||
import: "Importar",
|
||||
category: "Categoría",
|
||||
item: "Artículo",
|
||||
asset: "Activo",
|
||||
recipient: "Destinatario",
|
||||
assignment: "Asignación",
|
||||
},
|
||||
resetDatabase: {
|
||||
idle: "Reiniciar base de datos",
|
||||
loading: "Reiniciando...",
|
||||
successToast: "Base de datos reiniciada correctamente",
|
||||
errorToast: "Error al reiniciar la base de datos",
|
||||
},
|
||||
logout: {
|
||||
label: "Cerrar sesión",
|
||||
},
|
||||
})
|
||||
|
||||
expect(getDictionary("en").common.search).toEqual({
|
||||
placeholder: "Search...",
|
||||
label: "Search",
|
||||
clearLabel: "Clear search",
|
||||
})
|
||||
expect(getDictionary("es").common.search).toEqual({
|
||||
placeholder: "Buscar...",
|
||||
label: "Buscar",
|
||||
clearLabel: "Limpiar búsqueda",
|
||||
})
|
||||
|
||||
expect(getDictionary("en").common.pagination).toEqual({
|
||||
summaryPrefix: "Showing page",
|
||||
summarySeparator: "of",
|
||||
previous: "Previous",
|
||||
next: "Next",
|
||||
})
|
||||
expect(getDictionary("es").common.pagination).toEqual({
|
||||
summaryPrefix: "Mostrando página",
|
||||
summarySeparator: "de",
|
||||
previous: "Anterior",
|
||||
next: "Siguiente",
|
||||
})
|
||||
|
||||
expect(getDictionary("en").common.forbidden).toEqual({
|
||||
title: "Access denied",
|
||||
description: "You do not have permission to access this section.",
|
||||
homeLink: "Back to home",
|
||||
})
|
||||
expect(getDictionary("es").common.forbidden).toEqual({
|
||||
title: "Acceso denegado",
|
||||
description: "No tienes permisos para acceder a esta sección.",
|
||||
homeLink: "Volver al inicio",
|
||||
})
|
||||
})
|
||||
|
||||
it("keeps dashboard home dictionary keys aligned across locales", () => {
|
||||
expect(getDictionary("en").dashboardHome).toEqual({
|
||||
heading: "Dashboard",
|
||||
|
||||
Reference in New Issue
Block a user