mirror of
https://github.com/aljazceru/ditto.git
synced 2026-01-10 17:14:20 +01:00
refactor: make provider lowercase because supporting case insensitive is allegedly protocol bloat
This commit is contained in:
@@ -273,7 +273,7 @@ class Conf {
|
||||
}
|
||||
/** Translation provider used to translate posts. */
|
||||
static get translationProvider(): string | undefined {
|
||||
return Deno.env.get('TRANSLATION_PROVIDER')?.toLowerCase();
|
||||
return Deno.env.get('TRANSLATION_PROVIDER');
|
||||
}
|
||||
/** Translation provider URL endpoint. */
|
||||
static get translationProviderEndpoint(): string | undefined {
|
||||
|
||||
@@ -11,7 +11,7 @@ export const translatorMiddleware: AppMiddleware = async (c, next) => {
|
||||
const translationProvider = Conf.translationProvider;
|
||||
|
||||
switch (translationProvider) {
|
||||
case 'DeepL'.toLowerCase():
|
||||
case 'deepl':
|
||||
if (apiKey) {
|
||||
c.set(
|
||||
'translator',
|
||||
@@ -19,7 +19,7 @@ export const translatorMiddleware: AppMiddleware = async (c, next) => {
|
||||
);
|
||||
}
|
||||
break;
|
||||
case 'Libretranslate'.toLowerCase():
|
||||
case 'libretranslate':
|
||||
if (apiKey) {
|
||||
c.set(
|
||||
'translator',
|
||||
|
||||
@@ -7,7 +7,7 @@ import { getLanguage } from '@/test.ts';
|
||||
const endpoint = Conf.translationProviderEndpoint;
|
||||
const apiKey = Conf.translationProviderApiKey;
|
||||
const translationProvider = Conf.translationProvider;
|
||||
const deepL = 'DeepL'.toLowerCase();
|
||||
const deepL = 'deepl';
|
||||
|
||||
Deno.test('Translate status with EMPTY media_attachments and WITHOUT poll', {
|
||||
ignore: !(translationProvider === deepL && apiKey),
|
||||
|
||||
@@ -7,7 +7,7 @@ import { getLanguage } from '@/test.ts';
|
||||
const endpoint = Conf.translationProviderEndpoint;
|
||||
const apiKey = Conf.translationProviderApiKey;
|
||||
const translationProvider = Conf.translationProvider;
|
||||
const libreTranslate = 'Libretranslate'.toLowerCase();
|
||||
const libreTranslate = 'libretranslate';
|
||||
|
||||
Deno.test('Translate status with EMPTY media_attachments and WITHOUT poll', {
|
||||
ignore: !(translationProvider === libreTranslate && apiKey),
|
||||
|
||||
Reference in New Issue
Block a user