Skip to main content
Glama
useDictionaryAsync.ts1 kB
'use client'; import { computed, inject } from '@angular/core'; import configuration from '@intlayer/config/built'; import type { Dictionary, LocalesValues, StrictModeLocaleMap, } from '@intlayer/types'; import { INTLAYER_TOKEN, type IntlayerProvider } from './installIntlayer'; import { useDictionary } from './useDictionary'; /** * On the server side, Hook that transform a dictionary and return the content * * If the locale is not provided, it will use the locale from the client context */ export const useDictionaryAsync = async <T extends Dictionary>( dictionaryPromise: StrictModeLocaleMap<() => Promise<T>>, locale?: LocalesValues ) => { const intlayer = inject<IntlayerProvider>(INTLAYER_TOKEN); const localeTarget = computed( () => locale ?? intlayer?.locale() ?? configuration?.internationalization.defaultLocale ); const dictionary = await dictionaryPromise[localeTarget()]?.(); return useDictionary(dictionary, localeTarget() as any); };

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/aymericzip/intlayer'

If you have feedback or need assistance with the MCP directory API, please join our Discord server