Skip to main content
Glama
editorLocale.ts822 B
import { effect, inject } from '@angular/core'; import { MessageKey } from '@intlayer/editor'; import type { Locale, LocalesValues } from '@intlayer/types'; import { INTLAYER_TOKEN, type IntlayerProvider } from '../client'; import { createSharedComposable } from './createSharedComposable'; import { useCrossFrameState } from './useCrossFrameState'; export const useEditorLocale = createSharedComposable(() => { const client = inject<IntlayerProvider>(INTLAYER_TOKEN); if (!client) { throw new Error('IntlayerEditor state not found'); } const [_data, setData] = useCrossFrameState<LocalesValues>( MessageKey.INTLAYER_CURRENT_LOCALE ); // Use Angular effects instead of Vue watchers effect(() => { const newValue = client.locale(); setData(newValue as Locale); }); return client; });

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