Skip to content

Commit

Permalink
fix: fix for tests
Browse files Browse the repository at this point in the history
  • Loading branch information
strbit committed Aug 29, 2024
1 parent 1b16657 commit 9170c76
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ export async function readLocalesDir(
if (entry.isFile && extname(entry.name) === ".ftl") {
try {
const decoder = new TextDecoder("utf-8");
const filePath = join(path, entry.path.replace(path, ""));
const contents = Deno.readFileSync(filePath);
const excludeRoot = entry.path.replace(path, "");
const contents = await Deno.readFile(join(path, excludeRoot));

const belongsTo = entry.path.split(SEP)[1].split(".")[0];
const belongsTo = excludeRoot.split(SEP)[1].split(".")[0];
const translationSource = decoder.decode(contents);

files.push({
Expand Down Expand Up @@ -53,10 +53,10 @@ export function readLocalesDirSync(path: string): NestedTranslation[] {
if (entry.isFile && extname(entry.name) === ".ftl") {
try {
const decoder = new TextDecoder("utf-8");
const filePath = join(path, entry.path.replace(path, ""));
const contents = Deno.readFileSync(filePath);
const excludeRoot = entry.path.replace(path, "");
const contents = Deno.readFileSync(join(path, excludeRoot));

const belongsTo = entry.path.split(SEP)[1].split(".")[0];
const belongsTo = excludeRoot.split(SEP)[1].split(".")[0];
const translationSource = decoder.decode(contents);

files.push({
Expand Down

0 comments on commit 9170c76

Please sign in to comment.