Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add language independent field icon. #6298

Merged
merged 5 commits into from
Sep 28, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions packages/volto/locales/ca/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -1938,6 +1938,11 @@ msgstr "Llenguatge"
msgid "Language independent field."
msgstr ""

#. Default: "This is a language independent field. Any value you enter here will overwrite the corresponding field of all members of the translation group when you save this form."
#: components/manage/Widgets/FormFieldWrapper
msgid "Language independent icon title"
msgstr ""

#. Default: "Large"
#: components/manage/Widgets/ImageSizeWidget
msgid "Large"
Expand Down
5 changes: 5 additions & 0 deletions packages/volto/locales/de/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -1937,6 +1937,11 @@ msgstr "Sprache"
msgid "Language independent field."
msgstr "Sprachunabhängiges Feld."

#. Default: "This is a language independent field. Any value you enter here will overwrite the corresponding field of all members of the translation group when you save this form."
#: components/manage/Widgets/FormFieldWrapper
msgid "Language independent icon title"
msgstr "Dies ist ein sprachunabhängiges Feld. Jeder Wert, den Sie hier eingeben, überschreibt das entsprechende Feld aller Mitglieder der Übersetzungsgruppe, wenn Sie dieses Formular speichern."

#. Default: "Large"
#: components/manage/Widgets/ImageSizeWidget
msgid "Large"
Expand Down
5 changes: 5 additions & 0 deletions packages/volto/locales/en/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -1932,6 +1932,11 @@ msgstr ""
msgid "Language independent field."
msgstr ""

#. Default: "This is a language independent field. Any value you enter here will overwrite the corresponding field of all members of the translation group when you save this form."
#: components/manage/Widgets/FormFieldWrapper
msgid "Language independent icon title"
msgstr ""

#. Default: "Large"
#: components/manage/Widgets/ImageSizeWidget
msgid "Large"
Expand Down
5 changes: 5 additions & 0 deletions packages/volto/locales/es/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -1939,6 +1939,11 @@ msgstr "Idioma"
msgid "Language independent field."
msgstr "Campo independiente de idioma."

#. Default: "This is a language independent field. Any value you enter here will overwrite the corresponding field of all members of the translation group when you save this form."
#: components/manage/Widgets/FormFieldWrapper
msgid "Language independent icon title"
msgstr ""

#. Default: "Large"
#: components/manage/Widgets/ImageSizeWidget
msgid "Large"
Expand Down
5 changes: 5 additions & 0 deletions packages/volto/locales/eu/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -1939,6 +1939,11 @@ msgstr "Hizkuntza"
msgid "Language independent field."
msgstr "Hizkuntzarekiko Independentea den eremua."

#. Default: "This is a language independent field. Any value you enter here will overwrite the corresponding field of all members of the translation group when you save this form."
#: components/manage/Widgets/FormFieldWrapper
msgid "Language independent icon title"
msgstr ""

#. Default: "Large"
#: components/manage/Widgets/ImageSizeWidget
msgid "Large"
Expand Down
5 changes: 5 additions & 0 deletions packages/volto/locales/fi/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -1937,6 +1937,11 @@ msgstr "Kieli"
msgid "Language independent field."
msgstr "Kieliriippumaton kenttä"

#. Default: "This is a language independent field. Any value you enter here will overwrite the corresponding field of all members of the translation group when you save this form."
#: components/manage/Widgets/FormFieldWrapper
msgid "Language independent icon title"
msgstr ""

#. Default: "Large"
#: components/manage/Widgets/ImageSizeWidget
msgid "Large"
Expand Down
5 changes: 5 additions & 0 deletions packages/volto/locales/fr/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -1939,6 +1939,11 @@ msgstr "Langage"
msgid "Language independent field."
msgstr "Champ indépendant de la langue."

#. Default: "This is a language independent field. Any value you enter here will overwrite the corresponding field of all members of the translation group when you save this form."
#: components/manage/Widgets/FormFieldWrapper
msgid "Language independent icon title"
msgstr ""

#. Default: "Large"
#: components/manage/Widgets/ImageSizeWidget
msgid "Large"
Expand Down
5 changes: 5 additions & 0 deletions packages/volto/locales/hi/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -1932,6 +1932,11 @@ msgstr "भाषा"
msgid "Language independent field."
msgstr "भाषा स्वतंत्र क्षेत्र।"

#. Default: "This is a language independent field. Any value you enter here will overwrite the corresponding field of all members of the translation group when you save this form."
#: components/manage/Widgets/FormFieldWrapper
msgid "Language independent icon title"
msgstr ""

#. Default: "Large"
#: components/manage/Widgets/ImageSizeWidget
msgid "Large"
Expand Down
5 changes: 5 additions & 0 deletions packages/volto/locales/it/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -1932,6 +1932,11 @@ msgstr "Lingua"
msgid "Language independent field."
msgstr "Campo indipendete dalla lingua"

#. Default: "This is a language independent field. Any value you enter here will overwrite the corresponding field of all members of the translation group when you save this form."
#: components/manage/Widgets/FormFieldWrapper
msgid "Language independent icon title"
msgstr ""

#. Default: "Large"
#: components/manage/Widgets/ImageSizeWidget
msgid "Large"
Expand Down
5 changes: 5 additions & 0 deletions packages/volto/locales/ja/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -1937,6 +1937,11 @@ msgstr "言語"
msgid "Language independent field."
msgstr ""

#. Default: "This is a language independent field. Any value you enter here will overwrite the corresponding field of all members of the translation group when you save this form."
#: components/manage/Widgets/FormFieldWrapper
msgid "Language independent icon title"
msgstr ""

#. Default: "Large"
#: components/manage/Widgets/ImageSizeWidget
msgid "Large"
Expand Down
5 changes: 5 additions & 0 deletions packages/volto/locales/nl/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -1936,6 +1936,11 @@ msgstr "Taal"
msgid "Language independent field."
msgstr ""

#. Default: "This is a language independent field. Any value you enter here will overwrite the corresponding field of all members of the translation group when you save this form."
#: components/manage/Widgets/FormFieldWrapper
msgid "Language independent icon title"
msgstr ""

#. Default: "Large"
#: components/manage/Widgets/ImageSizeWidget
msgid "Large"
Expand Down
5 changes: 5 additions & 0 deletions packages/volto/locales/pt/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -1937,6 +1937,11 @@ msgstr "Idioma"
msgid "Language independent field."
msgstr ""

#. Default: "This is a language independent field. Any value you enter here will overwrite the corresponding field of all members of the translation group when you save this form."
#: components/manage/Widgets/FormFieldWrapper
msgid "Language independent icon title"
msgstr ""

#. Default: "Large"
#: components/manage/Widgets/ImageSizeWidget
msgid "Large"
Expand Down
5 changes: 5 additions & 0 deletions packages/volto/locales/pt_BR/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -1938,6 +1938,11 @@ msgstr "Idioma"
msgid "Language independent field."
msgstr "Campo independente da linguagem."

#. Default: "This is a language independent field. Any value you enter here will overwrite the corresponding field of all members of the translation group when you save this form."
#: components/manage/Widgets/FormFieldWrapper
msgid "Language independent icon title"
msgstr ""

#. Default: "Large"
#: components/manage/Widgets/ImageSizeWidget
msgid "Large"
Expand Down
5 changes: 5 additions & 0 deletions packages/volto/locales/ro/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -1932,6 +1932,11 @@ msgstr "Limba"
msgid "Language independent field."
msgstr "Câmp independent de limbă."

#. Default: "This is a language independent field. Any value you enter here will overwrite the corresponding field of all members of the translation group when you save this form."
#: components/manage/Widgets/FormFieldWrapper
msgid "Language independent icon title"
msgstr ""

#. Default: "Large"
#: components/manage/Widgets/ImageSizeWidget
msgid "Large"
Expand Down
7 changes: 6 additions & 1 deletion packages/volto/locales/volto.pot
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
msgid ""
msgstr ""
"Project-Id-Version: Plone\n"
"POT-Creation-Date: 2024-08-10T17:00:27.117Z\n"
"POT-Creation-Date: 2024-09-19T10:10:37.548Z\n"
"Last-Translator: Plone i18n <[email protected]>\n"
"Language-Team: Plone i18n <[email protected]>\n"
"Content-Type: text/plain; charset=utf-8\n"
Expand Down Expand Up @@ -1934,6 +1934,11 @@ msgstr ""
msgid "Language independent field."
msgstr ""

#. Default: "This is a language independent field. Any value you enter here will overwrite the corresponding field of all members of the translation group when you save this form."
#: components/manage/Widgets/FormFieldWrapper
msgid "Language independent icon title"
msgstr ""

#. Default: "Large"
#: components/manage/Widgets/ImageSizeWidget
msgid "Large"
Expand Down
5 changes: 5 additions & 0 deletions packages/volto/locales/zh_CN/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -1938,6 +1938,11 @@ msgstr "语言"
msgid "Language independent field."
msgstr "语言独立字段"

#. Default: "This is a language independent field. Any value you enter here will overwrite the corresponding field of all members of the translation group when you save this form."
#: components/manage/Widgets/FormFieldWrapper
msgid "Language independent icon title"
msgstr ""

#. Default: "Large"
#: components/manage/Widgets/ImageSizeWidget
msgid "Large"
Expand Down
1 change: 1 addition & 0 deletions packages/volto/news/6297.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add language independent field icon. @iRohitSingh
28 changes: 24 additions & 4 deletions packages/volto/src/components/manage/Widgets/FormFieldWrapper.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import { Form, Grid, Icon as IconOld, Label } from 'semantic-ui-react';
import { map } from 'lodash';
import cx from 'classnames';
import { defineMessages, injectIntl } from 'react-intl';
import LanguageSVG from '@plone/volto/icons/language.svg';
import { Icon } from '@plone/volto/components';

const messages = defineMessages({
edit: {
Expand All @@ -22,6 +24,11 @@ const messages = defineMessages({
id: 'Language independent field.',
defaultMessage: 'Language independent field.',
},
language_independent_icon_title: {
id: 'Language independent icon title',
defaultMessage:
'This is a language independent field. Any value you enter here will overwrite the corresponding field of all members of the translation group when you save this form.',
},
});
/**
* FormFieldWrapper component class.
Expand Down Expand Up @@ -91,6 +98,9 @@ class FormFieldWrapper extends Component {
noForInFieldLabel,
multilingual_options,
} = this.props;

const languageIndependent = multilingual_options?.language_independent;

const wdg = (
<>
{this.props.children}
Expand All @@ -112,16 +122,14 @@ class FormFieldWrapper extends Component {
description ? 'help' : '',
className,
`field-wrapper-${id}`,
multilingual_options?.language_independent
? 'language-independent-field'
: null,
languageIndependent ? 'language-independent-field' : null,
)}
>
<Grid>
<Grid.Row stretched>
{columns === 2 && (
<Grid.Column width="4">
<div className="wrapper">
<div className="wrapper title-icon-container">
iRohitSingh marked this conversation as resolved.
Show resolved Hide resolved
<label
id={`fieldset-${fieldSet}-field-label-${id}`}
htmlFor={noForInFieldLabel ? null : `field-${id}`}
Expand All @@ -133,6 +141,18 @@ class FormFieldWrapper extends Component {
/>
)}
{title}
{languageIndependent && (
<div className="languageIndependent-icon">
<Icon
title={intl.formatMessage(
messages.language_independent_icon_title,
)}
name={LanguageSVG}
size="24px"
color="#555"
/>
</div>
)}
pnicolli marked this conversation as resolved.
Show resolved Hide resolved
</label>
</div>
</Grid.Column>
Expand Down
12 changes: 12 additions & 0 deletions packages/volto/theme/themes/pastanaga/extras/widgets.less
Original file line number Diff line number Diff line change
Expand Up @@ -280,3 +280,15 @@ body.babel-view .field.language-independent-field {
}
}
}

// ### FormFieldWrapper ###
.wrapper.title-icon-container label {
display: flex !important;
align-items: center;
justify-content: space-between;

.languageIndependent-icon {
display: flex;
margin-left: 8px;
}
}
Loading