~homeworkprod/byceps

991bc685350665b53512a6b44e746eb5b893bd8b — Jochen Kupperschmidt 8 months ago 0e18663
Translate to English
M byceps/blueprints/admin/orga/templates/macros/admin/orga.html => byceps/blueprints/admin/orga/templates/macros/admin/orga.html +3 -5
@@ 4,13 4,11 @@
  {%- if is_soon %}<strong>{% endif %}

  {%- if days_until_next_birthday == 0 -%}
    heute
  {{ _('today') }}
  {%- elif days_until_next_birthday == 1 -%}
    morgen
  {%- elif days_until_next_birthday == 2 -%}
    übermorgen
  {{ _('tomorrow') }}
  {%- else -%}
    in {{ days_until_next_birthday }} Tagen
  {{ _('in %(days)s days', days=days_until_next_birthday) }}
  {%- endif %}

  {%- if is_soon %}</strong>{% endif %}

M byceps/services/news/html_service.py => byceps/services/news/html_service.py +3 -1
@@ 11,6 11,7 @@ Render HTML fragments from news items and images.
from functools import partial
from typing import List, Optional

from flask_babel import gettext
from jinja2 import Markup

from ...util.iterables import find


@@ 72,7 73,8 @@ def _render_image_caption(image: Image, attrs: str) -> str:
    if image.attribution:
        if caption:
            caption += ' '
        caption += f'<small>Bild: {image.attribution}</small>'
        credit_label = gettext('Image credit')
        caption += f'<small>{credit_label}: {image.attribution}</small>'

    if not caption:
        return ''

M byceps/services/text_markup/service.py => byceps/services/text_markup/service.py +3 -1
@@ 9,6 9,7 @@ byceps.services.text_markup.service
from html import escape

from bbcode import Parser
from flask_babel import gettext

try:
    from .smileys import get_smileys


@@ 64,8 65,9 @@ def _add_quote_formatter(parser: Parser) -> None:
        intro = ''
        if 'author' in options:
            author = escape(options['author'])
            verb = gettext('wrote')
            intro = (
                f'<p class="quote-intro"><cite>{author}</cite> schrieb:</p>\n'
                f'<p class="quote-intro"><cite>{author}</cite> {verb}:</p>\n'
            )
        return f'{intro}<blockquote>{value}</blockquote>'


M byceps/translations/de/LC_MESSAGES/messages.po => byceps/translations/de/LC_MESSAGES/messages.po +29 -2
@@ 352,13 352,14 @@ msgstr "Newsposts"
msgid "Storefront"
msgstr "Storefront"

#: byceps/blueprints/admin/maintenance/views.py:46
#: byceps/blueprints/admin/maintenance/views.py:45
#, python-format
msgid ""
"Deleted %(num_deleted)s login events older than %(minimum_age_in_days)s "
"days."
msgstr ""
"%(num_deleted)s Login-Events älter als %(minimum_age_in_days)s Tage wurden gelöscht."
"%(num_deleted)s Login-Events älter als %(minimum_age_in_days)s Tage "
"wurden gelöscht."

#: byceps/blueprints/admin/maintenance/templates/admin/maintenance/index.html:5
#: byceps/blueprints/admin/more/templates/admin/more/view_global.html:22


@@ 554,6 555,20 @@ msgstr ""
"%(screen_name)s wurde das Orga-Flag für die Marke %(brand_title)s "
"entzogen."

#: byceps/blueprints/admin/orga/templates/macros/admin/orga.html:7
#: byceps/util/datetime/format.py:72
msgid "today"
msgstr "heute"

#: byceps/blueprints/admin/orga/templates/macros/admin/orga.html:9
msgid "tomorrow"
msgstr "morgen"

#: byceps/blueprints/admin/orga/templates/macros/admin/orga.html:11
#, python-format
msgid "in %(days)s days"
msgstr "in %(days)s Tagen"

#: byceps/blueprints/admin/orga_team/forms.py:24
msgid "From party"
msgstr "Von Party"


@@ 1980,7 1995,19 @@ msgstr "Deine Nachricht an %(screen_name)s wurde versendet."
msgid "Send"
msgstr "Senden"

#: byceps/services/news/html_service.py:76
msgid "Image credit"
msgstr "Bild"

#: byceps/services/text_markup/service.py:68
msgid "wrote"
msgstr "schrieb"

#: byceps/util/views.py:33
msgid "Please log in."
msgstr "Bitte melde dich an."

#: byceps/util/datetime/format.py:74
msgid "yesterday"
msgstr "gestern"


M byceps/util/datetime/format.py => byceps/util/datetime/format.py +4 -2
@@ 11,6 11,8 @@ Date/time formatting.
from datetime import date, datetime, time, timedelta
from typing import Optional, Union

from flask_babel import gettext


DateOrDateTime = Union[date, datetime]



@@ 67,8 69,8 @@ def _format_date_smart(d: DateOrDateTime) -> Optional[str]:

    today = date.today()
    if d == today:
        return 'heute'
        return gettext('today')
    elif d == (today - timedelta(days=1)):
        return 'gestern'
        return gettext('yesterday')
    else:
        return None

M tests/unit/services/text_markup/test_render_html.py => tests/unit/services/text_markup/test_render_html.py +8 -8
@@ 64,7 64,7 @@ def test_quote_without_author():

def test_quote_with_author():
    text = '[quote author="CATS"]All your base are belong to us.[/quote]'
    expected = '<p class="quote-intro"><cite>CATS</cite> schrieb:</p>\n<blockquote>All your base are belong to us.</blockquote>'
    expected = '<p class="quote-intro"><cite>CATS</cite> wrote:</p>\n<blockquote>All your base are belong to us.</blockquote>'
    assert render_html(text) == expected




@@ 73,31 73,31 @@ def test_quote_with_author():
    [
        (
            '[quote author="foo]bar"]blah[/quote]',
            '<p class="quote-intro"><cite>foo]bar</cite> schrieb:</p>\n<blockquote>blah</blockquote>',
            '<p class="quote-intro"><cite>foo]bar</cite> wrote:</p>\n<blockquote>blah</blockquote>',
        ),
        (
            '[quote author="foo[bar"]blah[/quote]',
            '<p class="quote-intro"><cite>foo[bar</cite> schrieb:</p>\n<blockquote>blah</blockquote>',
            '<p class="quote-intro"><cite>foo[bar</cite> wrote:</p>\n<blockquote>blah</blockquote>',
        ),
        (
            '[quote author="foo][bar"]blah[/quote]',
            '<p class="quote-intro"><cite>foo][bar</cite> schrieb:</p>\n<blockquote>blah</blockquote>',
            '<p class="quote-intro"><cite>foo][bar</cite> wrote:</p>\n<blockquote>blah</blockquote>',
        ),
        (
            '[quote author="foo[]bar"]blah[/quote]',
            '<p class="quote-intro"><cite>foo[]bar</cite> schrieb:</p>\n<blockquote>blah</blockquote>',
            '<p class="quote-intro"><cite>foo[]bar</cite> wrote:</p>\n<blockquote>blah</blockquote>',
        ),
        (
            '[quote author="[foobar]"]blah[/quote]',
            '<p class="quote-intro"><cite>[foobar]</cite> schrieb:</p>\n<blockquote>blah</blockquote>',
            '<p class="quote-intro"><cite>[foobar]</cite> wrote:</p>\n<blockquote>blah</blockquote>',
        ),
        (
            '[quote author="]foobar["]blah[/quote]',
            '<p class="quote-intro"><cite>]foobar[</cite> schrieb:</p>\n<blockquote>blah</blockquote>',
            '<p class="quote-intro"><cite>]foobar[</cite> wrote:</p>\n<blockquote>blah</blockquote>',
        ),
        (
            '[quote author="<AngleBracketeer>"]careful.[/quote]',
            '<p class="quote-intro"><cite>&lt;AngleBracketeer&gt;</cite> schrieb:</p>\n<blockquote>careful.</blockquote>',
            '<p class="quote-intro"><cite>&lt;AngleBracketeer&gt;</cite> wrote:</p>\n<blockquote>careful.</blockquote>',
        ),
    ],
)