From e4ce6688508f9cc9326a2a586866361bed85ce83 Mon Sep 17 00:00:00 2001 From: undefined Date: Wed, 29 Jun 2022 00:31:44 +0800 Subject: [PATCH] core: bug fix --- packages/hydrooj/src/lib/i18n.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/hydrooj/src/lib/i18n.ts b/packages/hydrooj/src/lib/i18n.ts index 00ef4d3ca..022a9d614 100644 --- a/packages/hydrooj/src/lib/i18n.ts +++ b/packages/hydrooj/src/lib/i18n.ts @@ -7,7 +7,7 @@ declare global { } String.prototype.translate = function translate(...languages: string[]) { - if (languages[0].startsWith('en')) { + if (languages[0]?.startsWith('en')) { // For most use cases, source text equals to translated text in English. // So if it doesn't exist, we should use the original text instead of fallback. return locales[languages[0]]?.[this] || locales['en']?.[this] || this;