1
0
Fork 0
freesewing/sites/shared/prebuild/shared.mjs
2023-07-21 17:38:20 +02:00

23 lines
620 B
JavaScript

/*
* A header to include in auto-generated files
*/
export const header = `/*
* This file was auto-generated by the prebuild script
* Any changes you make to it will be lost on the next (pre)build.
*/
`
export const loadTranslations = async ({ namespaces = [], languages = [], site }) => {
const translations = {}
for (const lang of languages) {
translations[lang] = {}
for (const ns of namespaces) {
const t = await import(`../../${site}/public/locales/${lang}/${ns}.json`, {
assert: { type: 'json' },
})
translations[lang][ns] = t.default
}
}
return translations
}