Revert "Fixing Issue 305 - broken links because of language (#316)"

This reverts commit 7dc6c6c2da.
This commit is contained in:
Joel Marcey 2017-12-19 09:23:41 -08:00
parent 7dc6c6c2da
commit 18c9a2ab31
7 changed files with 163 additions and 161 deletions

View file

@ -1,68 +0,0 @@
/**
* Copyright (c) 2017-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
const CWD = process.cwd();
const fs = require('fs-extra');
const path = require('path');
const join = path.join;
const languages_js = join(CWD, 'lanauages.js');
const translation_js = join(CWD, 'translation.js');
const versions_json = join(CWD, 'versions.json');
class Translation {
constructor() {
this.enabled = false;
this.languages = [
{
enabled: true,
name: 'English',
tag: 'en',
},
];
this._load();
}
enabledLanguages() {
return this.languages.filter(lang => lang.enabled);
}
_load() {
if (fs.existsSync(languages_js)) {
this.enabled = true;
this.languages = require(language_js);
this.translation = require(translation_js);
}
}
}
class Versioning {
constructor() {
this.enabled = false;
this.latestVersion = null;
this.versions = [];
this._load();
}
_load() {
if (fs.existsSync(versions_json)) {
this.enabled = true;
this.versions = JSON.parse(fs.readFileSync(versions_json, 'utf8'));
this.latestVersion = this.versions[0];
}
}
}
const env = {
translation: new Translation(),
versioning: new Versioning(),
};
module.exports = env;