Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat [Deepcast]: add commands to translate selected test into every possible language #947

Merged
merged 5 commits into from
Mar 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions extensions/deepcast/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Deepcast

Translate words, or entire sentences, into 26 different languages using DeepL.

## How to get the API Token

1. Register for free at DeepL https://www.deepl.com/de/pro#developer.
2. Go to https://www.deepl.com/de/pro-account/summary.
3. Scroll down and get your API Token
182 changes: 182 additions & 0 deletions extensions/deepcast/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,188 @@
"subtitle": "Deepcast",
"description": "Translate text using DeepL",
"mode": "view"
},
{
"name": "bulgarian",
"title": "Translate Into Bulgarian",
"subtitle": "Deepcast",
"description": "Translate selected text into Bulgarian using DeepL",
"mode": "no-view"
},
{
"name": "chinese",
"title": "Translate Into Chinese",
"subtitle": "Deepcast",
"description": "Translate selected text into Chinese using DeepL",
"mode": "no-view"
},
{
"name": "czech",
"title": "Translate Into Czech",
"subtitle": "Deepcast",
"description": "Translate selected text into Czech using DeepL",
"mode": "no-view"
},
{
"name": "danish",
"title": "Translate Into Danish",
"subtitle": "Deepcast",
"description": "Translate selected text into Danish using DeepL",
"mode": "no-view"
},
{
"name": "dutch",
"title": "Translate Into Dutch",
"subtitle": "Deepcast",
"description": "Translate selected text into Dutch using DeepL",
"mode": "no-view"
},
{
"name": "englishUK",
"title": "Translate Into English (UK)",
"subtitle": "Deepcast",
"description": "Translate selected text into English (UK) using DeepL",
"mode": "no-view"
},
{
"name": "englishUS",
"title": "Translate Into English (US)",
"subtitle": "Deepcast",
"description": "Translate selected text into English (US) using DeepL",
"mode": "no-view"
},
{
"name": "estonian",
"title": "Translate Into Estonian",
"subtitle": "Deepcast",
"description": "Translate selected text into Estonian using DeepL",
"mode": "no-view"
},
{
"name": "finnish",
"title": "Translate Into Finnish",
"subtitle": "Deepcast",
"description": "Translate selected text into Finnish using DeepL",
"mode": "no-view"
},
{
"name": "french",
"title": "Translate Into French",
"subtitle": "Deepcast",
"description": "Translate selected text into French using DeepL",
"mode": "no-view"
},
{
"name": "german",
"title": "Translate Into German",
"subtitle": "Deepcast",
"description": "Translate selected text into German using DeepL",
"mode": "no-view"
},
{
"name": "greek",
"title": "Translate Into Greek",
"subtitle": "Deepcast",
"description": "Translate selected text into Greek using DeepL",
"mode": "no-view"
},
{
"name": "hungarian",
"title": "Translate Into Hungarian",
"subtitle": "Deepcast",
"description": "Translate selected text into Hungarian using DeepL",
"mode": "no-view"
},
{
"name": "italian",
"title": "Translate Into Italian",
"subtitle": "Deepcast",
"description": "Translate selected text into Italian using DeepL",
"mode": "no-view"
},
{
"name": "japanese",
"title": "Translate Into Japanese",
"subtitle": "Deepcast",
"description": "Translate selected text into Japanese using DeepL",
"mode": "no-view"
},
{
"name": "latvian",
"title": "Translate Into Latvian",
"subtitle": "Deepcast",
"description": "Translate selected text into Latvian using DeepL",
"mode": "no-view"
},
{
"name": "lithuanian",
"title": "Translate Into Lithuanian",
"subtitle": "Deepcast",
"description": "Translate selected text into Lithuanian using DeepL",
"mode": "no-view"
},
{
"name": "polish",
"title": "Translate Into Polish",
"subtitle": "Deepcast",
"description": "Translate selected text into Polish using DeepL",
"mode": "no-view"
},
{
"name": "portuguese",
"title": "Translate Into Portuguese",
"subtitle": "Deepcast",
"description": "Translate selected text into Portuguese using DeepL",
"mode": "no-view"
},
{
"name": "portugueseBrazil",
"title": "Translate Into Portuguese (Brazil)",
"subtitle": "Deepcast",
"description": "Translate selected text into Portuguese (Brazil) using DeepL",
"mode": "no-view"
},
{
"name": "romanian",
"title": "Translate Into Romanian",
"subtitle": "Deepcast",
"description": "Translate selected text into Romanian using DeepL",
"mode": "no-view"
},
{
"name": "russian",
"title": "Translate Into Russian",
"subtitle": "Deepcast",
"description": "Translate selected text into Russian using DeepL",
"mode": "no-view"
},
{
"name": "slovak",
"title": "Translate Into Slovak",
"subtitle": "Deepcast",
"description": "Translate selected text into Slovak using DeepL",
"mode": "no-view"
},
{
"name": "slovenian",
"title": "Translate Into Slovenian",
"subtitle": "Deepcast",
"description": "Translate selected text into Slovenian using DeepL",
"mode": "no-view"
},
{
"name": "spanish",
"title": "Translate Into Spanish",
"subtitle": "Deepcast",
"description": "Translate selected text into Spanish using DeepL",
"mode": "no-view"
},
{
"name": "swedish",
"title": "Translate Into Swedish",
"subtitle": "Deepcast",
"description": "Translate selected text into Swedish using DeepL",
"mode": "no-view"
}
],
"preferences": [
Expand Down
7 changes: 7 additions & 0 deletions extensions/deepcast/src/bulgarian.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { translate } from "./utils";

const Bulgarian = async () => {
await translate("BG");
return null;
};
export default Bulgarian;
7 changes: 7 additions & 0 deletions extensions/deepcast/src/chinese.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { translate } from "./utils";

const Chinese = async () => {
await translate("ZH");
return null;
};
export default Chinese;
7 changes: 7 additions & 0 deletions extensions/deepcast/src/czech.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { translate } from "./utils";

const Czech = async () => {
await translate("CS");
return null;
};
export default Czech;
7 changes: 7 additions & 0 deletions extensions/deepcast/src/danish.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { translate } from "./utils";

const Danish = async () => {
await translate("DA");
return null;
};
export default Danish;
7 changes: 7 additions & 0 deletions extensions/deepcast/src/dutch.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { translate } from "./utils";

const Dutch = async () => {
await translate("NL");
return null;
};
export default Dutch;
7 changes: 7 additions & 0 deletions extensions/deepcast/src/englishUK.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { translate } from "./utils";

const EnglishUK = async () => {
await translate("EN-GB");
return null;
};
export default EnglishUK;
7 changes: 7 additions & 0 deletions extensions/deepcast/src/englishUS.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { translate } from "./utils";

const EnglishUS = async () => {
await translate("EN-US");
return null;
};
export default EnglishUS;
7 changes: 7 additions & 0 deletions extensions/deepcast/src/estonian.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { translate } from "./utils";

const Estonian = async () => {
await translate("ET");
return null;
};
export default Estonian;
7 changes: 7 additions & 0 deletions extensions/deepcast/src/finnish.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { translate } from "./utils";

const Finnish = async () => {
await translate("FI");
return null;
};
export default Finnish;
7 changes: 7 additions & 0 deletions extensions/deepcast/src/french.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { translate } from "./utils";

const French = async () => {
await translate("FR");
return null;
};
export default French;
7 changes: 7 additions & 0 deletions extensions/deepcast/src/german.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { translate } from "./utils";

const German = async () => {
await translate("DE");
return null;
};
export default German;
7 changes: 7 additions & 0 deletions extensions/deepcast/src/greek.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { translate } from "./utils";

const Greek = async () => {
await translate("EL");
return null;
};
export default Greek;
7 changes: 7 additions & 0 deletions extensions/deepcast/src/hungarian.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { translate } from "./utils";

const Hungarian = async () => {
await translate("HU");
return null;
};
export default Hungarian;
7 changes: 6 additions & 1 deletion extensions/deepcast/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
} from "@raycast/api";
import got from "got";
import { useEffect, useState } from "react";
import { source_languages, target_languages } from "./languages";
import { source_languages, target_languages } from "./utils";

interface Values {
key?: string;
Expand Down Expand Up @@ -43,6 +43,11 @@ const Command = () => {
if (values.text) {
try {
setLoading(true);
console.log(
`https://api${pro ? "" : "-free"}.deepl.com/v2/translate?auth_key=${key}&text=${values.text}&target_lang=${
values.to
}${values.from ? `&source_lang=${values.from}` : ""}`
);
const response = await got(
`https://api${pro ? "" : "-free"}.deepl.com/v2/translate?auth_key=${key}&text=${values.text}&target_lang=${
values.to
Expand Down
7 changes: 7 additions & 0 deletions extensions/deepcast/src/italian.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { translate } from "./utils";

const Italian = async () => {
await translate("IT");
return null;
};
export default Italian;
7 changes: 7 additions & 0 deletions extensions/deepcast/src/japanese.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { translate } from "./utils";

const Japanese = async () => {
await translate("JA");
return null;
};
export default Japanese;
57 changes: 0 additions & 57 deletions extensions/deepcast/src/languages.ts

This file was deleted.

Loading