Email translations
This commit is contained in:
parent
952431d296
commit
6c8fa91f64
30 changed files with 1844 additions and 107 deletions
26
imports/api/Utility/server/files.js
Normal file
26
imports/api/Utility/server/files.js
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
import fs from 'fs';
|
||||
|
||||
const as = f => `assets/app/${f}`;
|
||||
|
||||
export const getFallbackLang = (lang) => {
|
||||
if (lang === 'ast' || lang === 'gl' || lang === 'eu' || lang === 'ca') {
|
||||
return 'es';
|
||||
}
|
||||
return 'en';
|
||||
};
|
||||
|
||||
|
||||
export const getFileNameOfLang = (dir, fileName, ext, lang) => {
|
||||
const base = `${dir}/${fileName}`;
|
||||
const fallback = getFallbackLang(lang);
|
||||
let file = `${base}-${lang}.${ext}`;
|
||||
if (!fs.existsSync(as(file))) {
|
||||
console.log(`Page '${fileName}' not found for '${lang}' lang`);
|
||||
file = `${base}-${fallback}.${ext}`;
|
||||
if (!fs.existsSync(as(file))) {
|
||||
console.log(`Page '${fileName}' not found for '${fallback}' lang`);
|
||||
file = `${base}.${ext}`;
|
||||
}
|
||||
}
|
||||
return file;
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue