feat(localization): add localization for static strings
This commit is contained in:
committed by
Benedikt Rötsch
parent
eaec09a594
commit
68a8052bdf
@@ -1,4 +1,5 @@
|
||||
const url = require('url')
|
||||
const { translate } = require('../i18n/i18n')
|
||||
|
||||
module.exports = (modifier) => {
|
||||
return (request, response, next) => {
|
||||
@@ -6,7 +7,10 @@ module.exports = (modifier) => {
|
||||
const urlComponents = url.parse(request.url).pathname.split('/').filter(Boolean)
|
||||
let breadcrumbs = []
|
||||
|
||||
breadcrumbs.push({ label: 'Home', url: baseUrl })
|
||||
breadcrumbs.push({
|
||||
label: translate('homeLabel', response.locals.currentLocale.code),
|
||||
url: baseUrl
|
||||
})
|
||||
// Map components of the path to breadcrumbs with resolvable URLs
|
||||
let mappedComponents = urlComponents.map((component, i, array) => {
|
||||
const path = array.slice(0, i + 1).join('/')
|
||||
|
||||
Reference in New Issue
Block a user