Browse Source

Remove debug line; Fix gettext

pull/38/head
Dashie der otter 3 months ago
parent
commit
3305b8ee8e
Signed by: Dashie <dashie@sigpipe.me> GPG Key ID: C2D57B325840B755
2 changed files with 5 additions and 6 deletions
  1. 0
    1
      app.py
  2. 5
    5
      forms.py

+ 0
- 1
app.py View File

@@ -156,7 +156,6 @@ def create_app(config_filename="config.py", app_name=None, register_blueprints=T
# otherwise try to guess the language from the user accept
# header the browser transmits. We support fr/en in this
# example. The best match wins.
print(f"Best locale choosed: {request.accept_languages.best_match(AVAILABLE_LOCALES)}")
return request.accept_languages.best_match(AVAILABLE_LOCALES)

@babel.timezoneselector

+ 5
- 5
forms.py View File

@@ -84,9 +84,9 @@ def get_licences():


class SoundUploadForm(Form):
title = StringField(gettext("Title"), [Length(max=255)])
description = TextAreaField(gettext("Description"))
sound = FileField(gettext("File"), [FileRequired(), FileAllowed(AUDIO)])
title = StringField(lazy_gettext("Title"), [Length(max=255)])
description = TextAreaField(lazy_gettext("Description"))
sound = FileField(lazy_gettext("File"), [FileRequired(), FileAllowed(AUDIO)])
album = QuerySelectField(
query_factory=get_albums,
allow_blank=True,
@@ -119,9 +119,9 @@ class SoundEditForm(Form):

def validate_private(form, field):
if field.data is True and form.album.data.private is False:
raise ValidationError(gettext("Cannot put private sound in public album"))
raise ValidationError(lazy_gettext("Cannot put private sound in public album"))
if field.data is True and form.sound.data.private is False:
raise ValidationError(gettext("Published sound cannot be privatized again"))
raise ValidationError(lazy_gettext("Published sound cannot be privatized again"))

submit = SubmitField(lazy_gettext("Edit sound"))


Loading…
Cancel
Save