diff --git a/.gitignore b/.gitignore index 72ff2985..ca0f3c4f 100644 --- a/.gitignore +++ b/.gitignore @@ -17,6 +17,7 @@ /build /public/umami.js /lang-compiled +/lang-formatted # misc .DS_Store diff --git a/components/WebsiteDetails.js b/components/WebsiteDetails.js index 3ff87de9..3a933638 100644 --- a/components/WebsiteDetails.js +++ b/components/WebsiteDetails.js @@ -60,7 +60,7 @@ export default function WebsiteDetails({ websiteId }) { component: BrowsersTable, }, { - label: , + label: , value: 'os', component: OSTable, }, diff --git a/components/metrics/OSTable.js b/components/metrics/OSTable.js index c94cf5c6..499e0f33 100644 --- a/components/metrics/OSTable.js +++ b/components/metrics/OSTable.js @@ -6,7 +6,7 @@ import { FormattedMessage } from 'react-intl'; export default function OSTable({ websiteId, limit, onExpand }) { return ( } + title={} type="os" metric={} websiteId={websiteId} diff --git a/components/settings/ProfileSettings.js b/components/settings/ProfileSettings.js index b58d7d32..9d9b011a 100644 --- a/components/settings/ProfileSettings.js +++ b/components/settings/ProfileSettings.js @@ -38,7 +38,9 @@ export default function ProfileSettings() {
{user.username}
{changePassword && ( - + } + > { + const lang = require(`../lang/${file}`); + const keys = Object.keys(lang).sort(); + + const formatted = keys.reduce((obj, key) => { + obj[key] = { defaultMessage: lang[key] }; + return obj; + }, {}); + + const json = prettier.format(JSON.stringify(formatted), { parser: 'json' }); + + fs.writeFileSync(path.resolve(dest, file), json); + + console.log(path.resolve(src, file), '->', path.resolve(dest, file)); +}); diff --git a/scripts/merge-lang.js b/scripts/merge-lang.js new file mode 100644 index 00000000..885bf759 --- /dev/null +++ b/scripts/merge-lang.js @@ -0,0 +1,30 @@ +const fs = require('fs'); +const path = require('path'); +const prettier = require('prettier'); +const root = require('../lang/en-US.json'); + +const dir = path.resolve(__dirname, '../lang'); +const files = fs.readdirSync(dir); +const keys = Object.keys(root).sort(); + +files.forEach(file => { + const lang = require(`../lang/${file}`); + + console.log(`Merging ${file}`); + + const merged = keys.reduce((obj, key) => { + const message = lang[key]; + + obj[key] = message || root[key]; + + if (!message) { + console.log(`* Added key ${key}`); + } + + return obj; + }, {}); + + const json = prettier.format(JSON.stringify(merged), { parser: 'json' }); + + fs.writeFileSync(path.resolve(dir, file), json); +});