Skip to content

Commit 08eaca1

Browse files
committed
feat: remove support for a translator
1 parent b761f6d commit 08eaca1

File tree

5 files changed

+4
-47
lines changed

5 files changed

+4
-47
lines changed

README.md

+1-4
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,9 @@
1414

1515
## 配置
1616

17+
- `token`:DeepL API Token(需自己购买)。
1718
- `formality` 正式程度: 设置翻译后的文本是倾向于正式语言还是非正式语言。此功能目前适用于所有目标语言,除了英语、英式英语、美式英语、西班牙语、汉语和日语。
1819

19-
## A Translator
20-
21-
每个月最少 20 港币即可使用 DeepL 翻译服务,详情请见 [a-translator.royli.dev](https://a-translator.royli.dev?utm_source=github&utm_medium=readme)
22-
2320
## 注意
2421

2522
### 字符是如何计费的?

scripts/bundle.js

-28
Original file line numberDiff line numberDiff line change
@@ -21,34 +21,6 @@ function generateInfo() {
2121
type: 'text',
2222
title: 'Token',
2323
},
24-
{
25-
identifier: 'provider',
26-
type: 'menu',
27-
title: 'API',
28-
defaultValue: 'deepl',
29-
menuValues: [
30-
{
31-
title: 'DeepL',
32-
value: 'deepl',
33-
},
34-
{
35-
title: 'A Translator',
36-
value: 'a-translator',
37-
},
38-
{
39-
title: 'A Translator (Global)',
40-
value: 'a-translator-cf',
41-
},
42-
...(process.env.NODE_ENV === 'development'
43-
? [
44-
{
45-
title: 'Local',
46-
value: 'local',
47-
},
48-
]
49-
: []),
50-
],
51-
},
5224
{
5325
identifier: 'formality',
5426
type: 'menu',

src/api.ts

+1-12
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,7 @@ export class Api {
88
constructor(private provider: validProvider | null, private token: string) {}
99

1010
private get baseUrl(): string {
11-
switch (this.provider) {
12-
case 'deepl':
13-
return 'https://api.deepl.com'
14-
case 'a-translator':
15-
return 'https://a-translator-api.nerdynerd.org'
16-
case 'a-translator-cf':
17-
return 'https://a-translator-api-cf.nerdynerd.org'
18-
case 'local':
19-
return 'http://localhost:1337'
20-
default:
21-
return 'https://a-translator-api.nerdynerd.org'
22-
}
11+
return 'https://api.deepl.com'
2312
}
2413

2514
async request<T = Record<string, unknown>>(

src/main.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export function translate(
1313
query: TranslateQuery,
1414
completion: (data: TranslateCompletion) => void,
1515
): void {
16-
const api = new Api($option.provider, $option.token)
16+
const api = new Api('deepl', $option.token)
1717

1818
;(async () => {
1919
const targetLanguage = langMap.get(query.detectTo)

types/global.d.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ export interface RequestCallbackResponse<T = Record<string, unknown>> {
5151

5252
interface $option {
5353
token: string
54-
provider: validProvider | null
5554
formality: 'default' | 'more' | 'less'
5655
}
5756

@@ -62,4 +61,4 @@ declare global {
6261
const $option: $option
6362
}
6463

65-
type validProvider = 'deepl' | 'a-translator' | 'a-translator-cf' | 'local'
64+
type validProvider = 'deepl'

0 commit comments

Comments
 (0)