From 3cca06057db2cc95833e317c5d5f7d0d117efbb2 Mon Sep 17 00:00:00 2001 From: Chris Anderson Date: Sat, 1 Apr 2023 18:47:49 -0500 Subject: [PATCH] Fixes locale parsing edge case (#109) --- apps/platform/src/utilities/index.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/platform/src/utilities/index.ts b/apps/platform/src/utilities/index.ts index fdcce59e..2e6aeb80 100644 --- a/apps/platform/src/utilities/index.ts +++ b/apps/platform/src/utilities/index.ts @@ -85,8 +85,9 @@ export const batch = (arr: T[], size: number) => { } export const parseLocale = (locale: string): string | undefined => { - const parts = locale.split('-') - return parts.length === 1 ? locale[0] : locale + return locale.slice(-1) === '-' + ? locale.slice(0, -1) + : locale } export const partialMatchLocale = (locale1?: string, locale2?: string) => {