core/source/init.ts
Christian Fraß 27d6b4eb16 [int]
2023-08-03 08:34:33 +02:00

50 lines
1.1 KiB
TypeScript

namespace _heimdall
{
/**
*/
export async function init(
) : Promise<void>
{
const workdir : string = __dirname;
// translation
{
const language_order : Array<string> = ["de", "en"];
await lib_plankton.translate.initialize_promise(
{
"verbosity": 1,
"order": language_order,
"packages": await Promise.all(
[
{"identifier": "de", "path": (workdir + "/localization/de.json")},
{"identifier": "en", "path": (workdir + "/localization/en.json")},
]
.map(
(entry) => (
lib_plankton.file.read(entry.path)
.then(content => Promise.resolve(JSON.parse(content)))
.then(tree => Promise.resolve({"meta": {"identifier": entry.identifier}, "tree": tree}))
)
)
),
}
);
const env_language : (null | string) = _heimdall.helpers.misc.get_env_language();
if (
! (
(env_language !== null)
&&
language_order.includes(env_language)
)
) {
// do nothing
}
else {
lib_plankton.translate.promote(env_language);
}
}
}
}