Skip to content

Commit

Permalink
fix agenda ednote english strings from sd (#209)
Browse files Browse the repository at this point in the history
CPNHUB-79
  • Loading branch information
petrjasek authored Sep 21, 2022
1 parent 526a538 commit d09688d
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 6 deletions.
30 changes: 29 additions & 1 deletion assets/agenda/components/AgendaEdNote.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,42 @@ import {gettext} from 'utils';
export default function AgendaEdNote({item, plan, secondaryNoteField, noMargin}) {
// We display Secondary Note only from 'item' for now
const displaySecondaryNote = secondaryNoteField && get(item, secondaryNoteField);

if (!item.ednote && !plan.ednote && !displaySecondaryNote) {
return null;
}

const tooltip = !item.ednote && !plan.ednote ? gettext('Reason') : gettext('Editorial Note');
const getMultiLineNote = (note) => (note && note.split('\n').map((t, key) =>
const fixText = (text) => {
// remove prefixes added by planning
// which are always in english
const POSTPONED = 0;
const RESCHEDULED = 1;
const prefixes = [];

prefixes[POSTPONED] = 'Event Postponed: ';
prefixes[RESCHEDULED] = 'Event Rescheduled: ';

return prefixes.reduce((_text, prefix, index) => {
if (_text.startsWith(prefix)) {
let reason = _text.substr(prefix.length);

switch (index) {
case POSTPONED:
return gettext('Event Postponed: {{reason}}', {reason});
case RESCHEDULED:
return gettext('Event Rescheduled: {{reason}}', {reason});
}
}

return _text;
}, text.trim());
};

const getMultiLineNote = (note) => (note && fixText(note).split('\n').map((t, key) =>
<span key={key}>{t}<br/></span>)
);

const getNoteFields = () => {
if (!item.ednote && !plan.ednote) {
// Display only Secondary Note
Expand Down
18 changes: 13 additions & 5 deletions messages.pot
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Newsroom-Core 2.1.0.dev0\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2022-09-01 10:11+0200\n"
"POT-Creation-Date: 2022-09-20 10:56+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
Expand All @@ -18,11 +18,11 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 2.10.3\n"

#: newsroom/email.py:391
#: newsroom/email.py:397
msgid "Kill/Takedown notice"
msgstr ""

#: newsroom/email.py:400
#: newsroom/email.py:406
msgid "Agenda cancelled notice"
msgstr ""

Expand Down Expand Up @@ -789,7 +789,7 @@ msgstr ""
msgid "Web"
msgstr ""

#: assets/agenda/components/AgendaEdNote.jsx:15
#: assets/agenda/components/AgendaEdNote.jsx:16
#: newsroom/templates/agenda_item_print.html:59
msgid "Editorial Note"
msgstr ""
Expand Down Expand Up @@ -1564,10 +1564,18 @@ msgstr ""
msgid "Coverages"
msgstr ""

#: assets/agenda/components/AgendaEdNote.jsx:15
#: assets/agenda/components/AgendaEdNote.jsx:16
msgid "Reason"
msgstr ""

#: assets/agenda/components/AgendaEdNote.jsx:33
msgid "Event Postponed: {{reason}}"
msgstr ""

#: assets/agenda/components/AgendaEdNote.jsx:35
msgid "Event Rescheduled: {{reason}}"
msgstr ""

#: assets/agenda/components/AgendaEventsOnlyFilter.jsx:7
msgid "Show Events Only"
msgstr ""
Expand Down

0 comments on commit d09688d

Please sign in to comment.