Skip to content

Commit a96c263

Browse files
committed
fix labels
1 parent e77efba commit a96c263

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

geonode_mapstore_client/client/js/plugins/MetadataEditor/components/_widgets/TextWidgetMultiLang.jsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import isString from 'lodash/isString';
1212

1313
import DefaultTextareaWidget from '@rjsf/core/lib/components/widgets/TextareaWidget';
1414
import IconWithTooltip from '../IconWithTooltip';
15-
import { getMessageById } from '@mapstore/framework/utils/LocaleUtils';
15+
import { getMessageById, getSupportedLocales } from '@mapstore/framework/utils/LocaleUtils';
1616

1717
const TextWidgetMultiLang = (props) => {
1818

@@ -23,13 +23,15 @@ const TextWidgetMultiLang = (props) => {
2323

2424
const languages = Object.keys(schema?.properties);
2525
const languageLabels = languages.reduce((acc, lang) => {
26-
const label = schema?.properties?.[lang]?.['geonode:multilang-lang-label'] || lang;
26+
const label = schema?.properties?.[lang]?.['geonode:multilang-lang-label'];
2727
acc[lang] = label;
2828
return acc;
2929
}, {});
3030

3131
const getLanguageName = (langCode) => {
32-
return languageLabels[langCode] || langCode;
32+
const languagesNames = getSupportedLocales();
33+
const langName = languageLabels[langCode] || languagesNames[langCode]?.description
34+
return `${langName} (${langCode})`
3335
};
3436

3537
const isTextarea = schema?.['ui:options']?.widget === 'textarea';

0 commit comments

Comments
 (0)