feat(localization): add localization for static strings

This commit is contained in:
David Litvak
2017-11-01 15:37:15 +01:00
committed by Benedikt Rötsch
parent eaec09a594
commit 68a8052bdf
24 changed files with 333 additions and 99 deletions

View File

@@ -1,4 +1,5 @@
const marked = require('marked')
const { translate } = require('./i18n/i18n')
// Parse markdown text
module.exports.markdown = (content = '') => {
@@ -11,11 +12,11 @@ module.exports.markdown = (content = '') => {
// A handy debugging function we can use to sort of "console.log" our data
module.exports.dump = (obj) => JSON.stringify(obj, null, 2)
module.exports.formatMetaTitle = (title) => {
module.exports.formatMetaTitle = (title, localeCode = 'en-US') => {
if (!title) {
return 'The Example App'
return translate('defaultTitle', localeCode)
}
return `${title.charAt(0).toUpperCase()}${title.slice(1)}The Example App`
return `${title.charAt(0).toUpperCase()}${title.slice(1)}${translate('defaultTitle', localeCode)}`
}
/**