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

@ -9,7 +9,6 @@
function execute(port) {
const translation = require("./translation.js");
translation();
const CWD = process.cwd();
const express = require("express");
const React = require("react");
@ -282,8 +281,8 @@ function execute(port) {
const match = regexLang.exec(req.path);
const parts = match[1].split("/");
const enabledLangTags = [];
for (let i = 0; i < siteConfig["languages"].length; i++) {
enabledLangTags.push(siteConfig["languages"][i].tag);
for (let i = 0; i < translation["languages"].length; i++) {
enabledLangTags.push(translation["languages"][i].tag);
}
for (let i = 0; i < parts.length; i++) {
if (enabledLangTags.indexOf(parts[i]) !== -1) {