@lingui/cli
Version:
Lingui CLI to extract messages, compile catalogs, and manage translation workflows
16 lines (15 loc) • 591 B
JavaScript
import nodepath from "path";
import { replacePlaceholders } from "../api/utils.js";
export function resolveCatalogPath(configOutput, entryPath, rootDir, locale, extension) {
const entryName = getEntryName(entryPath);
const entryDir = nodepath.relative(rootDir, nodepath.dirname(entryPath));
return nodepath.normalize(replacePlaceholders(configOutput, {
entryName,
entryDir,
locale,
}) + extension);
}
export function getEntryName(entryPath) {
const parsedPath = nodepath.parse(entryPath);
return parsedPath.name.replace(parsedPath.ext, "");
}