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:
@@ -17,6 +17,7 @@
|
||||
"logoAlt": "Die Beispielanwendung für Contentful",
|
||||
"homeLabel": "Startseite",
|
||||
"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.",
|
||||
"imprintLabel": "Impressum",
|
||||
"contactUsLabel": "Kontakt",
|
||||
@@ -74,7 +75,6 @@
|
||||
"fieldIsRequiredLabel": "Diese Feld ist notwendig.",
|
||||
"deliveryKeyInvalidLabel": "Ihr Delivery API Zugangsschlüssel ist ungültig.",
|
||||
"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.",
|
||||
"beginnerLabel": "Anfänger",
|
||||
"intermediateLabel": "Fortgeschrittener",
|
||||
|
||||
@@ -75,7 +75,6 @@
|
||||
"fieldIsRequiredLabel": "This field is required",
|
||||
"deliveryKeyInvalidLabel": "Your Delivery API key is invalid.",
|
||||
"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.",
|
||||
"beginnerLabel": "Beginner",
|
||||
"intermediateLabel": "Intermediate",
|
||||
|
||||
@@ -2,7 +2,7 @@ module.exports = (request, resource) => {
|
||||
const breadcrumbs = request.app.locals.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
|
||||
}
|
||||
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