Fix breadcrumb and add test for locales (#49)
* test(unit): add test to check for locale consistency * fix(breadcrumb): translate lessons route
This commit is contained in:
committed by
David Litvak Bruno
parent
1515d09dc2
commit
67b5d09a5c
@@ -17,6 +17,7 @@
|
|||||||
"logoAlt": "Die Beispielanwendung für Contentful",
|
"logoAlt": "Die Beispielanwendung für Contentful",
|
||||||
"homeLabel": "Startseite",
|
"homeLabel": "Startseite",
|
||||||
"coursesLabel": "Kurse",
|
"coursesLabel": "Kurse",
|
||||||
|
"lessonsLabel": "Lektionen",
|
||||||
"footerDisclaimer": "Powered by Contentful. Diese Website und deren Materialien existieren nur für Demonstrationszwecken. Sie können diese benutzen, um den Inhalt ihres Contentful Kontos anzusehen.",
|
"footerDisclaimer": "Powered by Contentful. Diese Website und deren Materialien existieren nur für Demonstrationszwecken. Sie können diese benutzen, um den Inhalt ihres Contentful Kontos anzusehen.",
|
||||||
"imprintLabel": "Impressum",
|
"imprintLabel": "Impressum",
|
||||||
"contactUsLabel": "Kontakt",
|
"contactUsLabel": "Kontakt",
|
||||||
@@ -74,7 +75,6 @@
|
|||||||
"fieldIsRequiredLabel": "Diese Feld ist notwendig.",
|
"fieldIsRequiredLabel": "Diese Feld ist notwendig.",
|
||||||
"deliveryKeyInvalidLabel": "Ihr Delivery API Zugangsschlüssel ist ungültig.",
|
"deliveryKeyInvalidLabel": "Ihr Delivery API Zugangsschlüssel ist ungültig.",
|
||||||
"spaceOrTokenInvalid": "Dieser Space existiert nicht, oder Ihr Access Token kommt nicht von diesem Space.",
|
"spaceOrTokenInvalid": "Dieser Space existiert nicht, oder Ihr Access Token kommt nicht von diesem Space.",
|
||||||
"somethingWentWrongLabel": "Irgendetwas lief falsch.",
|
|
||||||
"previewKeyInvalidLabel": "Ihr Preview API Zugangsschlüssel ist ungültig.",
|
"previewKeyInvalidLabel": "Ihr Preview API Zugangsschlüssel ist ungültig.",
|
||||||
"beginnerLabel": "Anfänger",
|
"beginnerLabel": "Anfänger",
|
||||||
"intermediateLabel": "Fortgeschrittener",
|
"intermediateLabel": "Fortgeschrittener",
|
||||||
|
|||||||
@@ -75,7 +75,6 @@
|
|||||||
"fieldIsRequiredLabel": "This field is required",
|
"fieldIsRequiredLabel": "This field is required",
|
||||||
"deliveryKeyInvalidLabel": "Your Delivery API key is invalid.",
|
"deliveryKeyInvalidLabel": "Your Delivery API key is invalid.",
|
||||||
"spaceOrTokenInvalid": "This space does not exist or your access token is not associated with your space.",
|
"spaceOrTokenInvalid": "This space does not exist or your access token is not associated with your space.",
|
||||||
"somethingWentWrongLabel": "Something went wrong",
|
|
||||||
"previewKeyInvalidLabel": "Your Preview API key is invalid.",
|
"previewKeyInvalidLabel": "Your Preview API key is invalid.",
|
||||||
"beginnerLabel": "Beginner",
|
"beginnerLabel": "Beginner",
|
||||||
"intermediateLabel": "Intermediate",
|
"intermediateLabel": "Intermediate",
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ module.exports = (request, resource) => {
|
|||||||
const breadcrumbs = request.app.locals.breadcrumb
|
const breadcrumbs = request.app.locals.breadcrumb
|
||||||
|
|
||||||
let enhancedBreadcrumbs = breadcrumbs.map((breadcrumb) => {
|
let enhancedBreadcrumbs = breadcrumbs.map((breadcrumb) => {
|
||||||
if (breadcrumb.label.replace(/ /g, '-') == resource.fields.slug) {
|
if (breadcrumb.label.replace(/ /g, '-') === resource.fields.slug) {
|
||||||
breadcrumb.label = resource.fields.title
|
breadcrumb.label = resource.fields.title
|
||||||
}
|
}
|
||||||
return breadcrumb
|
return breadcrumb
|
||||||
|
|||||||
11
test/unit/locales.test.js
Normal file
11
test/unit/locales.test.js
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
const germanLocales = require('../../i18n/locales/de-DE.json')
|
||||||
|
const englishLocales = require('../../i18n/locales/en-US.json')
|
||||||
|
|
||||||
|
describe('locales', () => {
|
||||||
|
test('all labels coexist in all locale files', async () => {
|
||||||
|
const germanKeys = Object.keys(germanLocales)
|
||||||
|
const englishKeys = Object.keys(englishLocales)
|
||||||
|
|
||||||
|
expect(germanKeys).toEqual(englishKeys)
|
||||||
|
})
|
||||||
|
})
|
||||||
Reference in New Issue
Block a user