Skip to content

Commit

Permalink
Merge pull request #636 from VitNode/fix/translate_lang_aith_ai
Browse files Browse the repository at this point in the history
fix(backend): Add missing content for i18n plugin file when using AI
  • Loading branch information
aXenDeveloper authored Jan 6, 2025
2 parents 6a984bb + a76ab26 commit ecd5886
Showing 1 changed file with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ export class TranslateAiLanguagesAdminService {
return;
}

const pluginPath = join(
ABSOLUTE_PATHS.plugin({ code: plugin.code }).frontend.languages,
`${code}.json`,
);

const textLang = JSON.parse(await readFile(langPath, 'utf-8'));
const { text } = await generateText({
model,
Expand All @@ -88,9 +93,16 @@ export class TranslateAiLanguagesAdminService {
Important: Skip translation if is already translated (and not identical to source).
Source content (en):
Source content (DEFAULT) (en):
${JSON.stringify(textLang, null, 2)}
${
existsSync(pluginPath)
? `Current content for (${code}):
${JSON.stringify(pluginPath, null, 2)}`
: ''
}
Return the same content with identical structure after translation.
`,
});
Expand Down

0 comments on commit ecd5886

Please sign in to comment.