Enhance Breadcrumbs (#39)
* chore(localization): remove duplicated locale files * feat(localization): add localization for breadcrumbs * feat(localization): add beadcrumb enhancements * feat(debugging): add npm run debug command * chore(localization): add unit tests * chore(breadcrumbs): fix tests and typos * chore(localization): add docs for translationAvailable * chore(localization): refactor translationAvailable
This commit is contained in:
committed by
GitHub
parent
a48fd1b63d
commit
81577c82fd
11
i18n/i18n.js
11
i18n/i18n.js
@@ -44,3 +44,14 @@ module.exports.translate = (symbol, locale = 'en-US') => {
|
||||
|
||||
return translatedValue
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if string is translatable
|
||||
* @param symbol string Identifier for static text
|
||||
* @param locale string Locale code
|
||||
*
|
||||
* @returns boolean
|
||||
*/
|
||||
module.exports.translationAvaliable = (symbol, locale = 'en-US') => {
|
||||
return !!(translations[locale] || {})[symbol]
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
"logoAlt": "Contentful Example App",
|
||||
"homeLabel": "Home",
|
||||
"coursesLabel": "Courses",
|
||||
"lessonsLabel": "Lessons",
|
||||
"footerDisclaimer": "Powered by Contentful. This website and the materials found on it are for demo purposes. You can use this to preview the content created on your Contentful account.",
|
||||
"imprintLabel": "Imprint",
|
||||
"contactUsLabel": "Contact us",
|
||||
|
||||
Reference in New Issue
Block a user