Rework custom behaviour

This commit is contained in:
CherryKitten 2022-11-29 23:08:37 +01:00
parent 1acb89c807
commit b296e2766f
5 changed files with 3 additions and 4 deletions

1
.gitignore vendored
View file

@ -52,7 +52,6 @@ api-docs.json
ormconfig.json
/custom
packages/backend/assets/instance.css
/locales/custom
# blender backups
*.blend1

0
custom/locales/.gitkeep Normal file
View file

View file

@ -16,7 +16,7 @@ gulp.task('copy:backend:views', () =>
);
gulp.task('copy:backend:custom', () =>
gulp.src('./custom/*').pipe(gulp.dest('./packages/backend/assets/'))
gulp.src('./custom/assets/*').pipe(gulp.dest('./packages/backend/assets/'))
);
gulp.task('copy:client:fonts', () =>

View file

@ -23,7 +23,7 @@ fs.readdirSync(__dirname).forEach((file) => {
}
})
fs.readdirSync(__dirname + '/custom').forEach((file) => {
fs.readdirSync(__dirname + '/../custom/locales').forEach((file) => {
if (file.includes('.yml')){
file = file.slice(0, file.indexOf('.'))
languages_custom.push(file);
@ -40,7 +40,7 @@ const primaries = {
const clean = (text) => text.replace(new RegExp(String.fromCodePoint(0x08), 'g'), '');
const locales = languages.reduce((a, c) => (a[c] = yaml.load(clean(fs.readFileSync(`${__dirname}/${c}.yml`, 'utf-8'))) || {}, a), {});
const locales_custom = languages_custom.reduce((a, c) => (a[c] = yaml.load(clean(fs.readFileSync(`${__dirname}/custom/${c}.yml`, 'utf-8'))) || {}, a), {});
const locales_custom = languages_custom.reduce((a, c) => (a[c] = yaml.load(clean(fs.readFileSync(`${__dirname}/../custom/locales/${c}.yml`, 'utf-8'))) || {}, a), {});
Object.assign(locales, locales_custom)
module.exports = Object.entries(locales)