mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 11:29:46 +00:00
refactor: make provider lowercase because supporting case insensitive is allegedly protocol bloat
This commit is contained in:
parent
4712cb1d80
commit
bfab84d937
4 changed files with 5 additions and 5 deletions
|
|
@ -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),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue