mirror of
https://github.com/apache/superset.git
synced 2026-05-21 15:55:10 +00:00
fix(frontend): prevent LanguagePicker crash when locale is missing from LANGUAGES config (#39585)
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -25,9 +25,9 @@ import { Typography } from '@superset-ui/core/components/Typography';
|
||||
|
||||
export interface Languages {
|
||||
[key: string]: {
|
||||
flag: string;
|
||||
url: string;
|
||||
name: string;
|
||||
flag?: string;
|
||||
url?: string;
|
||||
name?: string;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -61,9 +61,9 @@ export const useLanguageMenuItems = ({
|
||||
key: langKey,
|
||||
label: (
|
||||
<StyledLabel className="f16">
|
||||
<i className={`flag ${languages[langKey].flag}`} />
|
||||
<Typography.Link href={languages[langKey].url}>
|
||||
{languages[langKey].name}
|
||||
<i className={`flag ${languages[langKey]?.flag ?? 'us'}`} />
|
||||
<Typography.Link href={languages[langKey]?.url}>
|
||||
{languages[langKey]?.name}
|
||||
</Typography.Link>
|
||||
</StyledLabel>
|
||||
),
|
||||
@@ -75,7 +75,7 @@ export const useLanguageMenuItems = ({
|
||||
type: 'submenu' as const,
|
||||
label: (
|
||||
<span className="f16" aria-label={t('Languages')}>
|
||||
<i className={`flag ${languages[locale].flag}`} />
|
||||
<i className={`flag ${languages[locale]?.flag ?? 'us'}`} />
|
||||
</span>
|
||||
),
|
||||
icon: <Icons.CaretDownOutlined iconSize="xs" />,
|
||||
|
||||
Reference in New Issue
Block a user