update language settings

This commit is contained in:
Kalidou Diagne
2024-01-30 18:07:16 +00:00
parent a1e392cddd
commit 0918ab7349
5 changed files with 97 additions and 25 deletions

View File

@@ -1,9 +1,15 @@
import { MainNavProps } from "@/components/main-nav"
import { useTranslation } from "@/app/i18n/client"
import { LocaleTypes } from "@/app/i18n/settings"
import { LocaleTypes, fallbackLng, languageList } from "@/app/i18n/settings"
export function useAppSettings(lang: LocaleTypes) {
const { t } = useTranslation(lang, "common")
// get the active language label
const activeLanguage =
languageList.find((language) => language.key === lang)?.label ??
languageList.find((language) => language.key === fallbackLng)?.label
const MAIN_NAV: MainNavProps["items"] = [
{
title: t("menu.home"),
@@ -48,5 +54,6 @@ export function useAppSettings(lang: LocaleTypes) {
return {
MAIN_NAV,
activeLanguageLabel: activeLanguage,
}
}