@ -1,4 +1,5 @@
import { currentClient } from 'config/clients'
import map from 'lodash/map'
import { getSortedLangs } from 'helpers/getSortedLangs'
export const langs = [
@ -67,11 +68,21 @@ export const langs = [
locale : 'bg' ,
title : 'Български' ,
} ,
{
className : 'lv' ,
locale : 'lv' ,
title : 'latviešu' ,
} ,
] as const
export const langsOrder = currentClient === 'instat'
? [ 'en' , 'bg' , 'cs' , 'fr' , 'de' , 'nl' , 'it' , 'es' , 'pl' , 'pt' , 'ru' , 'uk' , 'zh' ]
: [ 'cs' , 'en' , 'bg' , 'fr' , 'de' , 'nl' , 'it' , 'es' , 'pl' , 'pt' , 'ru' , 'uk' , 'zh' ]
export const getLangsOrder = ( ) = > {
const commonLangsLocaleList = map ( langs , ( lang ) = > lang . locale ) . sort ( )
const clientLanglocaleIndex = commonLangsLocaleList . findIndex (
( locale ) = > locale === 'en' ,
)
commonLangsLocaleList . splice ( clientLanglocaleIndex , 1 ) . unshift ( 'en' )
return commonLangsLocaleList
}
// @ts-expect-error
export const langsList = getSortedLangs ( langs )