/**
* 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 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";
translation["languages"].map(lang => {
if (lang.tag == this.props.language) {
currentLanguage = lang.name;
}
if (lang.tag == this.props.language) {
return;
}
enabledLanguages.push(
{lang.name}
);
});
if (enabledLanguages.length < 1) {
return null;
}
if (siteConfig.recruitingLink) {
enabledLanguages.push(
Help Translate
);
}
return (
);
}
}
class HeaderNav extends React.Component {
constructor() {
super();
this.state = {
slideoutActive: false
};
}
makeInternalLinks(link) {
let updatedLink = link.href.replace(
/\/LANGUAGE\//,
"/" + this.props.language + "/"
);
if (this.props.version) {
updatedLink = updatedLink.replace(
/\/VERSION\//,
"/" + this.props.version + "/"
);
} else {
updatedLink = updatedLink.replace(/\/VERSION\//, "/");
}
return (
{translation[this.props.language]
? translation[this.props.language]["localized-strings"][link.text]
: link.text}
);
}
makeExternalLinks(link) {
return (
{translation[this.props.language]
? translation[this.props.language]["localized-strings"][link.text]
: link.text}
);
}
render() {
return (
);
}
renderResponsiveNav() {
return (
);
}
}
module.exports = HeaderNav;