Skip to content

Commit 3be89cf

Browse files
committed
fix translate plugin
1 parent 3246958 commit 3be89cf

File tree

6 files changed

+32
-57
lines changed

6 files changed

+32
-57
lines changed

docs/docs/plugins/distributors/discord.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
sidebar_position: 2
33
---
44

5-
# 💬 Discord Plugin
5+
# 👾 Discord Plugin
66

77
The Discord plugin enables distribution of curated content to Discord channels.
88

docs/sidebars.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,11 @@ const sidebars: SidebarsConfig = {
9191
id: "plugins/distributors/telegram",
9292
label: "📱 Telegram",
9393
},
94+
{
95+
type: "doc",
96+
id: "plugins/distributors/discord",
97+
label: "👾 Discord",
98+
},
9499
{
95100
type: "doc",
96101
id: "plugins/distributors/notion",

packages/translate-transform/src/index.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
1-
import type {
2-
SourceLanguageCode,
3-
TargetLanguageCode,
4-
TranslateTextOptions,
5-
} from "./types";
1+
import type { TranslateTextOptions } from "./types";
62
import type { TransformerPlugin, ActionArgs } from "@curatedotfun/types";
73
import { Translator } from "deepl-node";
4+
import type { SourceLanguageCode, TargetLanguageCode } from "deepl-node";
85

96
interface TranslationConfig extends Record<string, unknown> {
107
apiKey: string;
@@ -64,8 +61,8 @@ export default class TranslationTransformer
6461
// Perform translation
6562
const result = await this.translator.translateText(
6663
textToTranslate,
67-
this.config.sourceLang || null,
68-
this.config.targetLang,
64+
this.config.sourceLang as SourceLanguageCode,
65+
this.config.targetLang as TargetLanguageCode,
6966
{
7067
preserveFormatting: this.config.preserveFormatting ?? true,
7168
} as TranslateTextOptions,
Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,3 @@
1-
export type SourceLanguageCode = string;
2-
export type TargetLanguageCode =
3-
| "BG"
4-
| "CS"
5-
| "DA"
6-
| "DE"
7-
| "EL"
8-
| "EN-GB"
9-
| "EN-US"
10-
| "ES"
11-
| "ET"
12-
| "FI"
13-
| "FR"
14-
| "HU"
15-
| "ID"
16-
| "IT"
17-
| "JA"
18-
| "KO"
19-
| "LT"
20-
| "LV"
21-
| "NB"
22-
| "NL"
23-
| "PL"
24-
| "PT-BR"
25-
| "PT-PT"
26-
| "RO"
27-
| "RU"
28-
| "SK"
29-
| "SL"
30-
| "SV"
31-
| "TR"
32-
| "UK"
33-
| "ZH";
34-
351
export type TagHandlingMode = "html" | "xml";
362

373
export interface TranslateTextOptions {
@@ -47,18 +13,3 @@ export interface TranslationResult {
4713
text: string;
4814
detectedSourceLang?: string;
4915
}
50-
51-
export interface DeepL {
52-
translateText(
53-
text: string,
54-
sourceLang: string | null,
55-
targetLang: TargetLanguageCode,
56-
options?: TranslateTextOptions,
57-
): Promise<TranslationResult>;
58-
translateText(
59-
text: string[],
60-
sourceLang: string | null,
61-
targetLang: TargetLanguageCode,
62-
options?: TranslateTextOptions,
63-
): Promise<TranslationResult[]>;
64-
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"compilerOptions": {
4+
"emitDeclarationOnly": true,
5+
"noEmit": false
6+
}
7+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"compilerOptions": {
3+
"target": "ES2020",
4+
"module": "ESNext",
5+
"moduleResolution": "bundler",
6+
"declaration": true,
7+
"outDir": "./dist",
8+
"strict": true,
9+
"esModuleInterop": true,
10+
"skipLibCheck": true,
11+
"forceConsistentCasingInFileNames": true
12+
},
13+
"include": ["src/**/*"],
14+
"exclude": ["node_modules", "dist"]
15+
}

0 commit comments

Comments
 (0)