mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-12 00:27:21 +02:00
Fix and move writeTranslations.js file to write-translations.js, move tagline property of en.json inside localized-strings
This commit is contained in:
parent
dbbfecaf62
commit
ed648074f2
3 changed files with 9 additions and 9 deletions
|
@ -48,7 +48,7 @@ class Site extends React.Component {
|
|||
*/
|
||||
|
||||
render() {
|
||||
const tagline = this.props.config[this.props.language] ? this.props.config[this.props.language].tagline : this.props.config.tagline;
|
||||
const tagline = this.props.config[this.props.language] ? this.props.config[this.props.language]["localized-strings"].tagline : this.props.config.tagline;
|
||||
const title = this.props.title
|
||||
? this.props.title + ' · ' + this.props.config.title
|
||||
: this.props.config.title + ' · ' + tagline;
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
/**
|
||||
* Copyright (c) 2017-present, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
|
@ -13,12 +15,11 @@ const CWD = process.cwd();
|
|||
const fs = require("fs-extra");
|
||||
const mkdirp = require("mkdirp");
|
||||
const glob = require("glob");
|
||||
const readMetadata = require("./readMetadata.js");
|
||||
const readMetadata = require("./server/readMetadata.js");
|
||||
const path = require("path");
|
||||
const siteConfig = require(CWD + "/siteConfig.js");
|
||||
const babylon = require("babylon");
|
||||
const traverse = require("babel-traverse").default;
|
||||
const siteConfig = require(CWD + "/siteConfig.js");
|
||||
|
||||
function writeFileAndCreateFolder(file, content) {
|
||||
mkdirp.sync(file.replace(new RegExp("/[^/]*$"), ""));
|
||||
|
@ -29,9 +30,9 @@ function execute() {
|
|||
let translations = {
|
||||
"localized-strings": {
|
||||
next: "Next",
|
||||
previous: "Previous"
|
||||
previous: "Previous",
|
||||
tagline: siteConfig.tagline
|
||||
},
|
||||
tagline: siteConfig.tagline,
|
||||
"pages-strings": {}
|
||||
};
|
||||
|
||||
|
@ -59,7 +60,6 @@ function execute() {
|
|||
}
|
||||
|
||||
/* go through pages to look for text inside translate tags */
|
||||
const plugin = __dirname + "/find-strings-plugin.js";
|
||||
files = glob.sync(CWD + "/pages/en/**");
|
||||
files.forEach(file => {
|
||||
const extension = path.extname(file);
|
||||
|
@ -89,7 +89,6 @@ function execute() {
|
|||
});
|
||||
|
||||
writeFileAndCreateFolder(CWD + "/i18n/en.json", JSON.stringify(translations));
|
||||
|
||||
}
|
||||
|
||||
module.exports = execute;
|
||||
execute();
|
|
@ -25,6 +25,7 @@
|
|||
"docusaurus-start": "./lib/start-server.js",
|
||||
"docusaurus-build": "./lib/build-files.js",
|
||||
"docusaurus-publish": "./lib/publish-gh-pages.js",
|
||||
"docusaurus-examples": "./lib/copy-examples.js"
|
||||
"docusaurus-examples": "./lib/copy-examples.js",
|
||||
"docusaurus-write-translations": "./lib/write-translations.js"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue