Integrate handling of translation tag into static html building, add default description to translate tags

This commit is contained in:
Frank Li 2017-07-10 14:08:00 -07:00
parent ed648074f2
commit 30a8ff329a
4 changed files with 61 additions and 14 deletions

25
lib/server/translate.js Normal file
View file

@ -0,0 +1,25 @@
/**
* Copyright (c) 2017-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
const siteConfig = require(CWD + "/siteConfig.js");
let language = "en";
function setLanguage(lang) {
language = lang;
}
function translate(str) {
return siteConfig[language]["pages-strings"][str];
}
module.exports = {
setLanguage: setLanguage,
translate: translate
};