From ec8261c37c3324b8a9e1438abb37e9d041e80b82 Mon Sep 17 00:00:00 2001 From: nick-funk Date: Tue, 31 Oct 2023 10:58:52 -0600 Subject: [PATCH] use tenant locale to translate graphql errors if available previously, it was grabbing the locale from the context only which was always set to en-US by default instead of retrieving from the tenant which has the accurate locale. if the tenant is not available, we simply default back to the context locale to be safe. --- server/src/core/server/graph/plugins/helpers.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/src/core/server/graph/plugins/helpers.ts b/server/src/core/server/graph/plugins/helpers.ts index e5f6c41543..94465e66f2 100644 --- a/server/src/core/server/graph/plugins/helpers.ts +++ b/server/src/core/server/graph/plugins/helpers.ts @@ -101,7 +101,7 @@ function hoistCoralErrorExtensions( } // Get the translation bundle. - const bundle = ctx.i18n.getBundle(ctx.lang); + const bundle = ctx.i18n.getBundle(ctx.tenant ? ctx.tenant.locale : ctx.lang); // Translate the extensions. const extensions = originalError.serializeExtensions(bundle, ctx.id);