Moved the i18n strings into their respective folders

This commit is contained in:
Jocelyn Badgley (Twipped) 2021-08-11 13:48:29 -07:00
parent cfd40a85d8
commit a49d9bf21c
5 changed files with 8 additions and 7 deletions

View File

@ -12,7 +12,7 @@ const slugify = require('./lib/slugify');
const { stripHtml } = require('string-strip-html');
const markdownIt = require('markdown-it');
const i18n = require('../lang');
const i18n = require('./lang');
const mAnchor = require('markdown-it-anchor');

View File

@ -1,11 +1,12 @@
const languages = {
en: require('./en'),
es: require('./es'),
};
const languages = {};
module.exports = exports = function (lang, key, ...args) {
var entry = languages[lang] && languages[lang][key];
if (!languages[lang]) {
languages[lang] = require('../public/' + lang + '/_strings');
}
var entry = languages[lang][key];
if (!entry) entry = languages.en[key];
if (typeof entry === 'function') return entry(...args);
return entry || key;

View File

@ -5,7 +5,7 @@ const { map, uniq } = require('lodash');
const { resolve, ROOT, TYPE } = require('./resolve');
const { siteInfo } = require(resolve('package.json'));
const { minify } = require('html-minifier-terser');
const i18n = require('../lang');
const i18n = require('./lang');
const MINIFY_CONFIG = {
conservativeCollapse: true,