mirror of
https://fast.feibisi.com/https://github.com/parcelvoy/platform.git
synced 2025-09-01 12:26:08 +08:00
Fixes locale parsing edge case (#109)
This commit is contained in:
parent
0b2020309b
commit
3cca06057d
1 changed files with 3 additions and 2 deletions
|
@ -85,8 +85,9 @@ export const batch = <T>(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) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue