Skip to content

Commit

Permalink
Fix conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
pontusab committed Dec 27, 2024
1 parent 25693f3 commit f568418
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
Binary file added bun.lockb
Binary file not shown.
14 changes: 9 additions & 5 deletions packages/cli/src/commands/translate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import fs from "node:fs/promises";
import path from "node:path";
import { type OpenAIProvider, createOpenAI } from "@ai-sdk/openai";
import { intro, outro, spinner } from "@clack/prompts";
import type { LanguageModel } from "ai";
import chalk from "chalk";
import { type OllamaProvider, createOllama } from "ollama-ai-provider";
import { simpleGit } from "simple-git";
Expand All @@ -13,7 +14,6 @@ import type {
UpdateResult,
} from "../types.js";
import { getApiKey, getConfig } from "../utils.js";
import type { LanguageModel } from "ai";

const providersMap: Record<
Provider,
Expand Down Expand Up @@ -59,8 +59,8 @@ export async function translate(targetLocale?: string, force = false) {
const translationTasks = locales.flatMap((locale) =>
Object.entries(config.files).flatMap(([format, { include }]) =>
include.map(async (pattern) => {
let sourcePath;
let targetPath;
let sourcePath: string;
let targetPath: string;

if (typeof pattern === "string") {
sourcePath = pattern.replace("[locale]", config.locale.source);
Expand All @@ -84,7 +84,12 @@ export async function translate(targetLocale?: string, force = false) {
model,
);
} catch (error) {
return { locale, sourcePath, success: false, error } as RunResult;
return {
locale,
sourcePath,
success: false,
error,
} as RunResult;
}
}),
),
Expand Down Expand Up @@ -235,4 +240,3 @@ async function run(
summary,
};
}
``;

0 comments on commit f568418

Please sign in to comment.