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

fix agenda ednote english strings from sd #209

Merged
merged 1 commit into from
Sep 21, 2022
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
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