engine-bay/admin-portal

View on GitHub
EngineBay.AdminPortal/AdminPortal/src/lib/i18n-provider.ts

Summary

Maintainability
A
0 mins
Test Coverage
import polyglotI18nProvider from 'ra-i18n-polyglot';
import { TranslationMessages, resolveBrowserLocale } from 'react-admin';
import { en, nl } from './translations';

const translations: Record<string, TranslationMessages> = { en, nl };

export const i18nProvider = polyglotI18nProvider(
    locale => translations[locale] ? translations[locale] : translations.en,
    resolveBrowserLocale(), // default locale
    [
        { locale: 'en', name: 'English' },
        { locale: 'nl', name: 'Dutch' }
    ],
);