mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-09 01:13:55 +00:00
7e3aaa8c30
* style: consistent casing on menu * refactor: bundle demo from code * feat: allow uploading custom views
23 lines
842 B
TypeScript
23 lines
842 B
TypeScript
import { copyFileSync, existsSync, writeFileSync } from 'fs';
|
|
|
|
import { defaultTranslation } from '../bundle/bundledTranslations.js';
|
|
import { ensureDirectory } from '../utils/fileManagement.js';
|
|
import { publicDir, publicFiles, srcFiles } from './index.js';
|
|
|
|
/**
|
|
* ensures directories exist and populates translation
|
|
*/
|
|
export const populateTranslation = () => {
|
|
ensureDirectory(publicDir.translationsDir);
|
|
// if translations doesn't exist we want to use startup translation
|
|
try {
|
|
copyFileSync(srcFiles.translationReadme, publicFiles.translationReadme);
|
|
if (!existsSync(publicFiles.translationsFile)) {
|
|
// copy the startup translation only if user doesnt have one
|
|
writeFileSync(publicFiles.translationsFile, defaultTranslation, { encoding: 'utf-8' });
|
|
}
|
|
} catch (_) {
|
|
/* we do not handle this */
|
|
}
|
|
};
|