From 147ea4aadd9819084671ea1b3e5a3c6d9effb46b Mon Sep 17 00:00:00 2001 From: dangered wolf Date: Tue, 2 Jan 2024 19:32:27 -0500 Subject: [PATCH] Map zh -> zh-cn, tw -> zh-tw, cn -> zh-cn (#580) --- src/helpers/translate.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/helpers/translate.ts b/src/helpers/translate.ts index f95fcfa..15a6df5 100644 --- a/src/helpers/translate.ts +++ b/src/helpers/translate.ts @@ -29,8 +29,15 @@ export const translateStatus = async ( let translationApiResponse; let translationResults: TranslationPartial; - /* Fix up some language codes that may be mistakenly used */ + /* Clean up language codes so we can use them with Twitter API */ switch (language) { + case 'zh': + case 'cn': + language = 'zh-cn'; + break; + case 'tw': + language = 'zh-tw'; + break; case 'jp': language = 'ja'; break;