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

feat: new BandoStatus component to manage the current status translations #390

Merged
merged 5 commits into from
Nov 7, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
12 changes: 4 additions & 8 deletions locales/de/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -1011,8 +1011,7 @@ msgstr ""
msgid "bandi_search_no_filters"
msgstr ""

#: components/ItaliaTheme/Blocks/Listing/BandiInEvidenceTemplate
#: components/ItaliaTheme/View/Commons/PageHeader/PageHeaderBando
#: components/ItaliaTheme/View/Commons/BandoStatus
# defaultMessage: Scaduto
msgid "bando_closed"
msgstr ""
Expand All @@ -1038,14 +1037,12 @@ msgstr ""
msgid "bando_ente"
msgstr ""

#: components/ItaliaTheme/Blocks/Listing/BandiInEvidenceTemplate
#: components/ItaliaTheme/View/Commons/PageHeader/PageHeaderBando
#: components/ItaliaTheme/View/Commons/BandoStatus
# defaultMessage: In corso
msgid "bando_inProgress"
msgstr ""

#: components/ItaliaTheme/Blocks/Listing/BandiInEvidenceTemplate
#: components/ItaliaTheme/View/Commons/PageHeader/PageHeaderBando
#: components/ItaliaTheme/View/Commons/BandoStatus
# defaultMessage: Attivo
msgid "bando_open"
msgstr ""
Expand All @@ -1055,8 +1052,7 @@ msgstr ""
msgid "bando_scadenza"
msgstr ""

#: components/ItaliaTheme/Blocks/Listing/BandiInEvidenceTemplate
#: components/ItaliaTheme/View/Commons/PageHeader/PageHeaderBando
#: components/ItaliaTheme/View/Commons/BandoStatus
# defaultMessage: Programmato
msgid "bando_scheduled"
msgstr ""
Expand Down
12 changes: 4 additions & 8 deletions locales/en/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -996,8 +996,7 @@ msgstr ""
msgid "bandi_search_no_filters"
msgstr ""

#: components/ItaliaTheme/Blocks/Listing/BandiInEvidenceTemplate
#: components/ItaliaTheme/View/Commons/PageHeader/PageHeaderBando
#: components/ItaliaTheme/View/Commons/BandoStatus
# defaultMessage: Scaduto
msgid "bando_closed"
msgstr "Expired"
Expand All @@ -1023,14 +1022,12 @@ msgstr "Publication date"
msgid "bando_ente"
msgstr "Supplying authority"

#: components/ItaliaTheme/Blocks/Listing/BandiInEvidenceTemplate
#: components/ItaliaTheme/View/Commons/PageHeader/PageHeaderBando
#: components/ItaliaTheme/View/Commons/BandoStatus
# defaultMessage: In corso
msgid "bando_inProgress"
msgstr "In progress"

#: components/ItaliaTheme/Blocks/Listing/BandiInEvidenceTemplate
#: components/ItaliaTheme/View/Commons/PageHeader/PageHeaderBando
#: components/ItaliaTheme/View/Commons/BandoStatus
# defaultMessage: Attivo
msgid "bando_open"
msgstr "Active"
Expand All @@ -1040,8 +1037,7 @@ msgstr "Active"
msgid "bando_scadenza"
msgstr "Expiration date:"

#: components/ItaliaTheme/Blocks/Listing/BandiInEvidenceTemplate
#: components/ItaliaTheme/View/Commons/PageHeader/PageHeaderBando
#: components/ItaliaTheme/View/Commons/BandoStatus
# defaultMessage: Programmato
msgid "bando_scheduled"
msgstr "Scheduled"
Expand Down
12 changes: 4 additions & 8 deletions locales/es/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -1005,8 +1005,7 @@ msgstr "Fondo de bloque"
msgid "bandi_search_no_filters"
msgstr "No hay filtros para mostrar. Seleccione yo filtros de búsqueda para mostrar desde la barra lateral."

#: components/ItaliaTheme/Blocks/Listing/BandiInEvidenceTemplate
#: components/ItaliaTheme/View/Commons/PageHeader/PageHeaderBando
#: components/ItaliaTheme/View/Commons/BandoStatus
# defaultMessage: Scaduto
msgid "bando_closed"
msgstr "Expirado"
Expand All @@ -1032,14 +1031,12 @@ msgstr "Fecha de publicación"
msgid "bando_ente"
msgstr "Autoridad proveedora"

#: components/ItaliaTheme/Blocks/Listing/BandiInEvidenceTemplate
#: components/ItaliaTheme/View/Commons/PageHeader/PageHeaderBando
#: components/ItaliaTheme/View/Commons/BandoStatus
# defaultMessage: In corso
msgid "bando_inProgress"
msgstr "En progreso"

#: components/ItaliaTheme/Blocks/Listing/BandiInEvidenceTemplate
#: components/ItaliaTheme/View/Commons/PageHeader/PageHeaderBando
#: components/ItaliaTheme/View/Commons/BandoStatus
# defaultMessage: Attivo
msgid "bando_open"
msgstr "Activar"
Expand All @@ -1049,8 +1046,7 @@ msgstr "Activar"
msgid "bando_scadenza"
msgstr "Fecha de expiración:"

#: components/ItaliaTheme/Blocks/Listing/BandiInEvidenceTemplate
#: components/ItaliaTheme/View/Commons/PageHeader/PageHeaderBando
#: components/ItaliaTheme/View/Commons/BandoStatus
# defaultMessage: Programmato
msgid "bando_scheduled"
msgstr "Programado"
Expand Down
12 changes: 4 additions & 8 deletions locales/fr/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -1013,8 +1013,7 @@ msgstr ""
msgid "bandi_search_no_filters"
msgstr ""

#: components/ItaliaTheme/Blocks/Listing/BandiInEvidenceTemplate
#: components/ItaliaTheme/View/Commons/PageHeader/PageHeaderBando
#: components/ItaliaTheme/View/Commons/BandoStatus
# defaultMessage: Scaduto
msgid "bando_closed"
msgstr "Expiré"
Expand All @@ -1040,14 +1039,12 @@ msgstr "Date de publication"
msgid "bando_ente"
msgstr "Autorité fournisseur"

#: components/ItaliaTheme/Blocks/Listing/BandiInEvidenceTemplate
#: components/ItaliaTheme/View/Commons/PageHeader/PageHeaderBando
#: components/ItaliaTheme/View/Commons/BandoStatus
# defaultMessage: In corso
msgid "bando_inProgress"
msgstr "En cours"

#: components/ItaliaTheme/Blocks/Listing/BandiInEvidenceTemplate
#: components/ItaliaTheme/View/Commons/PageHeader/PageHeaderBando
#: components/ItaliaTheme/View/Commons/BandoStatus
# defaultMessage: Attivo
msgid "bando_open"
msgstr "Actif"
Expand All @@ -1057,8 +1054,7 @@ msgstr "Actif"
msgid "bando_scadenza"
msgstr "Date d'expiration"

#: components/ItaliaTheme/Blocks/Listing/BandiInEvidenceTemplate
#: components/ItaliaTheme/View/Commons/PageHeader/PageHeaderBando
#: components/ItaliaTheme/View/Commons/BandoStatus
# defaultMessage: Programmato
msgid "bando_scheduled"
msgstr ""
Expand Down
12 changes: 4 additions & 8 deletions locales/it/LC_MESSAGES/volto.po
Original file line number Diff line number Diff line change
Expand Up @@ -996,8 +996,7 @@ msgstr "Sfondo del blocco"
msgid "bandi_search_no_filters"
msgstr "Nessun filtro da mostrare. Seleziona i filtri di ricerca da mostrare dalla sidebar laterale."

#: components/ItaliaTheme/Blocks/Listing/BandiInEvidenceTemplate
#: components/ItaliaTheme/View/Commons/PageHeader/PageHeaderBando
#: components/ItaliaTheme/View/Commons/BandoStatus
# defaultMessage: Scaduto
msgid "bando_closed"
msgstr "Scaduto"
Expand All @@ -1023,14 +1022,12 @@ msgstr "Data di pubblicazione"
msgid "bando_ente"
msgstr "Ente erogatore"

#: components/ItaliaTheme/Blocks/Listing/BandiInEvidenceTemplate
#: components/ItaliaTheme/View/Commons/PageHeader/PageHeaderBando
#: components/ItaliaTheme/View/Commons/BandoStatus
# defaultMessage: In corso
msgid "bando_inProgress"
msgstr "In corso"

#: components/ItaliaTheme/Blocks/Listing/BandiInEvidenceTemplate
#: components/ItaliaTheme/View/Commons/PageHeader/PageHeaderBando
#: components/ItaliaTheme/View/Commons/BandoStatus
# defaultMessage: Attivo
msgid "bando_open"
msgstr "Attivo"
Expand All @@ -1040,8 +1037,7 @@ msgstr "Attivo"
msgid "bando_scadenza"
msgstr "Scadenza partecipazione"

#: components/ItaliaTheme/Blocks/Listing/BandiInEvidenceTemplate
#: components/ItaliaTheme/View/Commons/PageHeader/PageHeaderBando
#: components/ItaliaTheme/View/Commons/BandoStatus
# defaultMessage: Programmato
msgid "bando_scheduled"
msgstr "Programmato"
Expand Down
14 changes: 5 additions & 9 deletions 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: 2023-11-06T11:52:47.601Z\n"
"POT-Creation-Date: 2023-11-07T09:01:50.705Z\n"
"Last-Translator: Plone i18n <[email protected]>\n"
"Language-Team: Plone i18n <[email protected]>\n"
"MIME-Version: 1.0\n"
Expand Down Expand Up @@ -998,8 +998,7 @@ msgstr ""
msgid "bandi_search_no_filters"
msgstr ""

#: components/ItaliaTheme/Blocks/Listing/BandiInEvidenceTemplate
#: components/ItaliaTheme/View/Commons/PageHeader/PageHeaderBando
#: components/ItaliaTheme/View/Commons/BandoStatus
# defaultMessage: Scaduto
msgid "bando_closed"
msgstr ""
Expand All @@ -1025,14 +1024,12 @@ msgstr ""
msgid "bando_ente"
msgstr ""

#: components/ItaliaTheme/Blocks/Listing/BandiInEvidenceTemplate
#: components/ItaliaTheme/View/Commons/PageHeader/PageHeaderBando
#: components/ItaliaTheme/View/Commons/BandoStatus
# defaultMessage: In corso
msgid "bando_inProgress"
msgstr ""

#: components/ItaliaTheme/Blocks/Listing/BandiInEvidenceTemplate
#: components/ItaliaTheme/View/Commons/PageHeader/PageHeaderBando
#: components/ItaliaTheme/View/Commons/BandoStatus
# defaultMessage: Attivo
msgid "bando_open"
msgstr ""
Expand All @@ -1042,8 +1039,7 @@ msgstr ""
msgid "bando_scadenza"
msgstr ""

#: components/ItaliaTheme/Blocks/Listing/BandiInEvidenceTemplate
#: components/ItaliaTheme/View/Commons/PageHeader/PageHeaderBando
#: components/ItaliaTheme/View/Commons/BandoStatus
# defaultMessage: Programmato
msgid "bando_scheduled"
msgstr ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ import {
} from 'design-comuni-plone-theme/components/ItaliaTheme';
import { viewDate } from 'design-comuni-plone-theme/helpers';

import { BandoStatus } from 'design-comuni-plone-theme/components/ItaliaTheme/View';

const messages = defineMessages({
vedi: {
id: 'bando_vedi',
Expand All @@ -40,22 +42,6 @@ const messages = defineMessages({
id: 'bando_stato',
defaultMessage: 'Stato:',
},
open: {
id: 'bando_open',
defaultMessage: 'Attivo',
},
scheduled: {
id: 'bando_scheduled',
defaultMessage: 'Programmato',
},
closed: {
id: 'bando_closed',
defaultMessage: 'Scaduto',
},
inProgress: {
id: 'bando_inProgress',
defaultMessage: 'In corso',
},
ente: {
id: 'bando_ente',
defaultMessage: 'Ente',
Expand Down Expand Up @@ -215,7 +201,7 @@ const BandiInEvidenceTemplate = ({
),
})}
>
{intl.formatMessage(messages[item.bando_state[0]])}
<BandoStatus content={item} />
</div>
</span>
</span>
Expand Down
38 changes: 38 additions & 0 deletions src/components/ItaliaTheme/View/Commons/BandoStatus.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/**
* Importante: (06/11/2023)
* Component creato per essere possibile customizzare in modo più efficiente le traduzioni per lo status dei bandi.
* Deve essere cancellato dopo l'aggiornamento di Volto
*/

import { defineMessages, useIntl } from 'react-intl';

const messages = defineMessages({
open: {
id: 'bando_open',
defaultMessage: 'Attivo',
},
closed: {
id: 'bando_closed',
defaultMessage: 'Scaduto',
},
inProgress: {
id: 'bando_inProgress',
defaultMessage: 'In corso',
},
scheduled: {
id: 'bando_scheduled',
defaultMessage: 'Programmato',
},
});

/**
* BandoStatus view component class.
* @function BandoStatus
*/

const BandoStatus = ({ content }) => {
const intl = useIntl();
return <>{intl.formatMessage(messages[content.bando_state[0]])}</>;
};

export default BandoStatus;
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import PropTypes from 'prop-types';

import { Icon } from 'design-comuni-plone-theme/components/ItaliaTheme';

import { BandoStatus } from 'design-comuni-plone-theme/components/ItaliaTheme/View';

/**
* PageHeaderBando view component class.
* @function PageHeaderBando
Expand All @@ -17,22 +19,6 @@ const messages = defineMessages({
id: 'Bando',
defaultMessage: 'Bando',
},
open: {
id: 'bando_open',
defaultMessage: 'attivo',
},
closed: {
id: 'bando_closed',
defaultMessage: 'scaduto',
},
inProgress: {
id: 'bando_inProgress',
defaultMessage: 'in corso',
},
scheduled: {
id: 'bando_scheduled',
defaultMessage: 'programmato',
},
});

const PageHeaderBando = ({ content }) => {
Expand Down Expand Up @@ -64,7 +50,7 @@ const PageHeaderBando = ({ content }) => {
size=""
/>
{intl.formatMessage(messages.bando)}{' '}
{intl.formatMessage(messages[content.bando_state[0]])}
<BandoStatus content={content} />
</div>
</div>
</div>
Expand Down
1 change: 1 addition & 0 deletions src/components/ItaliaTheme/View/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ export Sponsors from 'design-comuni-plone-theme/components/ItaliaTheme/View/Comm
export RelatedItems from 'design-comuni-plone-theme/components/ItaliaTheme/View/Commons/RelatedItems';
export RelatedItemInEvidence from 'design-comuni-plone-theme/components/ItaliaTheme/View/Commons/RelatedItemInEvidence/RelatedItemInEvidence';
export DownloadFileFormat from 'design-comuni-plone-theme/components/ItaliaTheme/View/Commons/DownloadFileFormat';
export BandoStatus from 'design-comuni-plone-theme/components/ItaliaTheme/View/Commons/BandoStatus';
export BandoDates from 'design-comuni-plone-theme/components/ItaliaTheme/View/Commons/BandoDates';

/* --- View --- */
Expand Down