Skip to content

Commit 28e7964

Browse files
committed
fix getLanguageName()
1 parent 2440a07 commit 28e7964

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import { getMessageById } from '@mapstore/framework/utils/LocaleUtils';
1818
const TextWidgetMultiLang = (props) => {
1919

2020
const { formData, onChange, schema, required, formContext } = props;
21-
console.log('TextWidgetMultiLang props', props);
2221

2322
const id = props.id || Math.random().toString(36).substring(7);
2423
const { title, description } = schema;
@@ -30,7 +29,7 @@ const TextWidgetMultiLang = (props) => {
3029
return acc;
3130
}, {});
3231

33-
const languageLong = (langCode) => {
32+
const getLanguageName = (langCode) => {
3433
return languageLabels[langCode] || langCode;
3534
};
3635

@@ -49,7 +48,7 @@ const TextWidgetMultiLang = (props) => {
4948
onChange(newValue);
5049
};
5150

52-
const placeholder = getMessageById(formContext.messages, "gnviewer.typeText").replace("{lang}", languageLong(currentLang));
51+
const placeholder = getMessageById(formContext.messages, "gnviewer.typeText").replace("{lang}", getLanguageName(currentLang));
5352

5453
return (
5554
<div className="form-group field field-string multilang-widget">
@@ -89,7 +88,7 @@ const TextWidgetMultiLang = (props) => {
8988
className={`btn btn-xs ${currentLang === lang ? "btn-primary" : "btn-outline-secondary"}`}
9089
onClick={() => setCurrentLang(lang)}
9190
>
92-
{languageLong(lang)}
91+
{getLanguageName(lang)}
9392
</button>
9493
))}
9594
</div>

geonode_mapstore_client/client/js/plugins/MetadataEditor/containers/MetadataEditor.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ function MetadataEditor({
103103
...metadataSingleLang,
104104
...Object.keys(schemaSingleLang?.properties || {}).reduce((acc, key) => {
105105
const property = schemaSingleLang.properties[key];
106-
if (property?.['geonode:multilang'] === true) {
106+
if (property?.['geonode:multilang']) {
107107
acc[key] = Object.keys(metadataSingleLang || {}).reduce((langAcc, dataKey) => {
108108
const dataProperty = schemaSingleLang.properties[dataKey];
109109
if (dataProperty?.['geonode:multilang-group'] === key) {
@@ -126,7 +126,7 @@ function MetadataEditor({
126126

127127
Object.keys(schemaMultiLang?.properties || {}).forEach(key => {
128128
const property = schemaMultiLang.properties[key];
129-
if (property?.['geonode:multilang'] === true && metadataMultiLang[key]) {
129+
if (property?.['geonode:multilang'] && metadataMultiLang[key]) {
130130
Object.entries(metadataMultiLang[key] || {}).forEach(([lang, value]) => {
131131
const singleLangKey = Object.keys(schemaMultiLang.properties).find(k => {
132132
const prop = schemaMultiLang.properties[k];
@@ -186,7 +186,7 @@ function MetadataEditor({
186186
...schemaSingleLang,
187187
properties: Object.keys(schemaSingleLang?.properties || {}).reduce((acc, key) => {
188188
const property = { ...schemaSingleLang.properties[key] };
189-
if (property?.['geonode:multilang'] === true) {
189+
if (property?.['geonode:multilang']) {
190190
const newProperty = {
191191
...property,
192192
type: 'object',

0 commit comments

Comments
 (0)