mirror of
https://github.com/facebook/docusaurus.git
synced 2025-08-06 10:20:09 +02:00
Add Prettier Formatting (#258)
* Add Prettier formatting to source files and example files, and check that Prettier formatting is maintained on PRs * Remove trailing-comma as we are using Node 6 on Circle * Use latest Node 6 LTS version in Circle * Remove unused test
This commit is contained in:
parent
0cead4b6f9
commit
65421db62e
50 changed files with 1376 additions and 1350 deletions
|
@ -8,35 +8,35 @@
|
|||
// translation object contains all translations for each string in 18n/en.json
|
||||
|
||||
const CWD = process.cwd();
|
||||
const fs = require("fs");
|
||||
const glob = require("glob");
|
||||
const path = require("path");
|
||||
const fs = require('fs');
|
||||
const glob = require('glob');
|
||||
const path = require('path');
|
||||
|
||||
let languages;
|
||||
if (fs.existsSync(CWD + "/languages.js")) {
|
||||
languages = require(CWD + "/languages.js");
|
||||
if (fs.existsSync(CWD + '/languages.js')) {
|
||||
languages = require(CWD + '/languages.js');
|
||||
} else {
|
||||
languages = [
|
||||
{
|
||||
enabled: true,
|
||||
name: "English",
|
||||
tag: "en"
|
||||
}
|
||||
name: 'English',
|
||||
tag: 'en',
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
const enabledLanguages = languages.filter(lang => lang.enabled);
|
||||
|
||||
const translation = { languages: enabledLanguages };
|
||||
const translation = {languages: enabledLanguages};
|
||||
|
||||
const files = glob.sync(CWD + "/i18n/**");
|
||||
const files = glob.sync(CWD + '/i18n/**');
|
||||
const langRegex = /\/i18n\/(.*)\.json$/;
|
||||
|
||||
console.log("Loading translation files...");
|
||||
console.log('Loading translation files...');
|
||||
|
||||
files.forEach(file => {
|
||||
const extension = path.extname(file);
|
||||
if (extension === ".json") {
|
||||
if (extension === '.json') {
|
||||
const match = langRegex.exec(file);
|
||||
const language = match[1];
|
||||
translation[language] = require(file);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue