mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-24 05:28:01 +02:00
Move references to languages and translated strings out of siteConfig.js into new translation.js module
This commit is contained in:
parent
48916d9f39
commit
099a13a264
9 changed files with 52 additions and 112 deletions
|
@ -11,6 +11,7 @@ const React = require("react");
|
|||
const classNames = require("classnames");
|
||||
|
||||
const siteConfig = require(process.cwd() + "/siteConfig.js");
|
||||
const translation = require("../../server/translation.js");
|
||||
|
||||
class SideNav extends React.Component {
|
||||
render() {
|
||||
|
@ -61,15 +62,15 @@ class SideNav extends React.Component {
|
|||
);
|
||||
}
|
||||
getLocalizedCategoryString(category) {
|
||||
let categoryString = siteConfig[this.props.language]
|
||||
? siteConfig[this.props.language]["localized-strings"][category] ||
|
||||
let categoryString = translation[this.props.language]
|
||||
? translation[this.props.language]["localized-strings"][category] ||
|
||||
category
|
||||
: category;
|
||||
return categoryString;
|
||||
}
|
||||
getLocalizedString(metadata) {
|
||||
let localizedString = siteConfig[this.props.language]
|
||||
? siteConfig[this.props.language]["localized-strings"][
|
||||
let localizedString = translation[this.props.language]
|
||||
? translation[this.props.language]["localized-strings"][
|
||||
metadata.localized_id
|
||||
] || metadata.title
|
||||
: metadata.title;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue