Skip to content

Commit e989a21

Browse files
authored
Bump deepl-node from 1.17.3 to 1.18.0 (#161)
1 parent 6d148b2 commit e989a21

16 files changed

+1246
-1198
lines changed

.tool-versions

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
nodejs 23.10.0
1+
nodejs 24.1.0

.yarn/releases/yarn-4.7.0.cjs

Lines changed: 0 additions & 935 deletions
This file was deleted.

.yarn/releases/yarn-4.9.1.cjs

Lines changed: 948 additions & 0 deletions
Large diffs are not rendered by default.

.yarnrc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ plugins:
44
- path: .yarn/plugins/@yarnpkg/plugin-outdated.cjs
55
spec: "https://mskelton.dev/yarn-outdated/v2"
66

7-
yarnPath: .yarn/releases/yarn-4.7.0.cjs
7+
yarnPath: .yarn/releases/yarn-4.9.1.cjs

README.md

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ more details for each provider below.
5252
### DeepL
5353

5454
* Identifier is `deepl`.
55-
* Supported translation directions can be found [here](https://www.deepl.com/docs-api/general/get-languages/).
55+
* See [supported translation directions](https://www.deepl.com/docs-api/general/get-languages/)
56+
for more details.
5657
* Be aware that source and target languages should be separated by `-` (hyphen)
5758
character while using them in `lang` input. For example, `en-uk` should be used
5859
in case you want to translate text from English into Ukrainian. See example
@@ -92,7 +93,8 @@ Translation is 'Любов'
9293
### Google
9394

9495
* Identifier is `google`.
95-
* Supported translation directions can be found [here](https://github.com/AidanWelch/google-translate-api/blob/master/index.d.ts#L67).
96+
* See [supported translation directions](https://github.com/AidanWelch/google-translate-api/blob/master/index.d.ts#L67)
97+
for more details.
9698
* Be aware that source and target languages should be separated by `-` (hyphen)
9799
character while using them in `lang` input. For example, `ms-en` should be used
98100
in case you want to translate text from Malay into English. See example below
@@ -128,7 +130,8 @@ Translation is 'Victory'
128130
### LibreTranslate
129131

130132
* Identifier is `libretranslate`.
131-
* Supported translation directions can be found [here](https://libretranslate.com/languages).
133+
* See [supported translation directions](https://libretranslate.com/languages)
134+
for more details.
132135
* Be aware that source and target languages should be separated by `-` (hyphen)
133136
character while using them in `lang` input. For example, `en-es` should be used
134137
in case you want to translate text from English into Spanish. See example
@@ -199,10 +202,10 @@ with:
199202
### MyMemory
200203
201204
* Identifier is `mymemory`.
202-
* Supported translation directions:
205+
* [Supported translation directions](https://mymemory.translated.net/doc/spec.php):
203206

204207
Language direction should be separated by `|` character. For example, `en|it`
205-
(from English to Italian). More details [here](https://mymemory.translated.net/doc/spec.php).
208+
(from English to Italian).
206209

207210
* How to get API key:
208211

@@ -215,10 +218,11 @@ and generate a new key.
215218
### FunTranslations
216219

217220
* Identifier is `funtranslations`.
218-
* Supported translation directions:
221+
* [Supported translation directions](https://funtranslations.com/api/):
222+
223+
> `from` direction is English only at this moment.
219224

220-
`from` direction is English only at this moment, so `lang` parameter can be
221-
found [here](https://funtranslations.com/api/). Example:
225+
Example:
222226

223227
```yaml
224228
- uses: fabasoad/translation-action@main

dist/index.js

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,19 @@
2727
"dependencies": {
2828
"@actions/core": "1.11.1",
2929
"cross-fetch": "4.1.0",
30-
"deepl-node": "1.17.3",
30+
"deepl-node": "1.18.0",
3131
"google-translate-api-x": "10.7.2",
3232
"typed-rest-client": "2.1.0"
3333
},
3434
"devDependencies": {
3535
"@biomejs/biome": "1.9.4",
3636
"@types/jest": "29.5.14",
3737
"@vercel/ncc": "0.38.3",
38-
"dotenv": "16.4.7",
38+
"dotenv": "16.5.0",
3939
"jest": "29.7.0",
4040
"jest-circus": "29.7.0",
41-
"ts-jest": "29.2.6",
42-
"typescript": "5.8.2"
41+
"ts-jest": "29.3.4",
42+
"typescript": "5.8.3"
4343
},
44-
"packageManager": "yarn@4.7.0"
44+
"packageManager": "yarn@4.9.1"
4545
}

src/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ async function run() {
88
const source: string = extract(core.getInput('source'))
99
const providerFactory: ProviderFactory = new ProviderFactory()
1010
const provider: ProviderBase = providerFactory.getProvider(
11-
core.getInput('provider') as ProviderType,
12-
core.getInput('api_key'),
13-
core.getInput('api_additional_parameter')
11+
core.getInput('provider', { required: true, trimWhitespace: true }) as ProviderType,
12+
core.getInput('api_key', { required: false, trimWhitespace: true }),
13+
core.getInput('api_additional_parameter', { required: false, trimWhitespace: true })
1414
)
1515
let text: string
1616
try {

src/providers/DeeplProvider.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
import ProviderBase from './ProviderBase'
2-
import {SourceLanguageCode, TargetLanguageCode, Translator} from 'deepl-node'
2+
import {
3+
SourceLanguageCode,
4+
TargetLanguageCode,
5+
TextResult,
6+
Translator
7+
} from 'deepl-node'
38

49
export default class DeeplProvider extends ProviderBase {
510
private translator: Translator
@@ -11,7 +16,7 @@ export default class DeeplProvider extends ProviderBase {
1116

1217
async translate(text: string, lang: string): Promise<string[]> {
1318
const l: string[] = lang.split('-')
14-
const result = await this.translator.translateText<string>(
19+
const result: TextResult = await this.translator.translateText<string>(
1520
text, l[0] as SourceLanguageCode, l[1] as TargetLanguageCode
1621
)
1722
return Promise.resolve([result.text])

src/providers/FunTranslationsProvider.ts

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,13 @@ export default class FunTranslationsProvider extends ProviderBase {
1010

1111
async translate(text: string, lang: string): Promise<string[]> {
1212
const url = `/translate/${lang}.json?text=${text}`
13-
return this.api<FunTranslationsResponse>({ url, method: 'GET' })
14-
.then(({ success, contents }) => {
15-
if (success && success.total > 0) {
16-
return [contents.translated]
17-
}
18-
console.warn(
19-
'Result is either not success or doesn\'t have any translations')
20-
return [text]
21-
})
13+
const { success, contents }: FunTranslationsResponse =
14+
await this.api<FunTranslationsResponse>({ url, method: 'GET' })
15+
if (success && success.total > 0) {
16+
return [contents.translated]
17+
}
18+
console.warn(
19+
'Result is either not success or doesn\'t have any translations')
20+
return [text]
2221
}
2322
}

0 commit comments

Comments
 (0)