Move references to languages and translated strings out of siteConfig.js into new translation.js module

This commit is contained in:
Frank Li 2017-07-11 17:03:27 -07:00
parent 48916d9f39
commit 099a13a264
9 changed files with 52 additions and 112 deletions

View file

@ -10,13 +10,14 @@
const React = require("react");
const siteConfig = require(process.cwd() + "/siteConfig.js");
const translation = require("../../server/translation.js");
class LanguageDropDown extends React.Component {
render() {
const enabledLanguages = [];
let currentLanguage = "English";
siteConfig["languages"].map(lang => {
translation["languages"].map(lang => {
if (lang.tag == this.props.language) {
currentLanguage = lang.name;
}
@ -97,8 +98,8 @@ class HeaderNav extends React.Component {
href={linkWithLang}
className={link.section === this.props.section ? "active" : ""}
>
{siteConfig[this.props.language]
? siteConfig[this.props.language]["localized-strings"][link.text]
{translation[this.props.language]
? translation[this.props.language]["localized-strings"][link.text]
: link.text}
</a>
</li>