Files
Stirling-PDF/frontend/src/core/components/shared/AppConfigLoader.tsx
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

26 lines
872 B
TypeScript
Raw Normal View History

2025-10-28 14:47:41 +00:00
import { useEffect } from 'react';
import { useAppConfig } from '@app/contexts/AppConfigContext';
import { updateSupportedLanguages } from '@app/i18n';
/**
* Component that loads app configuration and applies it to the application.
* This includes:
* - Filtering available languages based on config.languages
*
* Place this component high in the component tree, after i18n has initialized.
*/
export default function AppConfigLoader() {
const { config, loading } = useAppConfig();
useEffect(() => {
if (!loading && config) {
2025-12-10 00:09:45 +00:00
// Update supported languages and apply default locale from server config
// Priority: localStorage > config.defaultLocale > browser detection > fallback
updateSupportedLanguages(config.languages, config.defaultLocale);
2025-10-28 14:47:41 +00:00
}
}, [config, loading]);
// This component doesn't render anything
return null;
}