16 lines
625 B
Nim
16 lines
625 B
Nim
import std/os
|
|
|
|
template translationDataPath(name: static[string], visibility: static[string]): string =
|
|
const dataRoot = currentSourcePath().parentDir.parentDir / "data"
|
|
dataRoot / visibility / (name & ".tsv")
|
|
|
|
template hasEmbeddedTranslationData*(name: static[string]): bool =
|
|
fileExists(translationDataPath(name, "private")) or
|
|
fileExists(translationDataPath(name, "public"))
|
|
|
|
template embeddedTranslationData*(name: static[string]): string =
|
|
when fileExists(translationDataPath(name, "private")):
|
|
staticRead(translationDataPath(name, "private"))
|
|
else:
|
|
staticRead(translationDataPath(name, "public"))
|