Skip to main content
Glama
installIntlayer.ts1.42 kB
import { Injectable, InjectionToken, type Signal, signal } from '@angular/core'; import configuration from '@intlayer/config/built'; import type { LocalesValues } from '@intlayer/types'; export const INTLAYER_TOKEN = new InjectionToken<IntlayerProvider>('intlayer'); /** * Singleton instance */ let instance: IntlayerProvider | null = null; @Injectable({ providedIn: 'root', }) export class IntlayerProvider { isCookieEnabled = signal(true); private _locale = signal<LocalesValues>( configuration.internationalization?.defaultLocale as LocalesValues ); readonly locale: Signal<LocalesValues> = this._locale.asReadonly(); setLocale = (locale: LocalesValues) => { this._locale.set(locale); }; } /** * Create and return a single IntlayerProvider instance */ export const createIntlayerClient = ( locale?: LocalesValues, isCookieEnabled = true ): IntlayerProvider => { if (instance) return instance; instance = new IntlayerProvider(); if (locale) { instance.setLocale(locale); } instance.isCookieEnabled.set(isCookieEnabled); return instance; }; /** * Helper to install the Intlayer provider */ export const installIntlayer = ( locale?: LocalesValues, isCookieEnabled = true ) => { const client = createIntlayerClient(locale, isCookieEnabled); // Note: Angular editor installation will be handled differently // installIntlayerEditor(); 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