From 0232ec9fd3319919b618ec88f498ee39755247e9 Mon Sep 17 00:00:00 2001 From: Jason McBrayer Date: Sun, 4 Nov 2018 10:42:18 -0500 Subject: [PATCH] Add i18n hooks to models --- brutaldon/models.py | 11 ++++++----- brutaldon/views.py | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/brutaldon/models.py b/brutaldon/models.py index 9e4e562..074a144 100644 --- a/brutaldon/models.py +++ b/brutaldon/models.py @@ -1,5 +1,6 @@ from django.db import models from django.conf import settings +from django.utils.translation import gettext as _ from pytz import common_timezones timezones = [(tz, tz) for tz in common_timezones] @@ -31,15 +32,15 @@ class Preference(models.Model): timezone = models.CharField(max_length=80, blank=True, null=True, choices=timezones, default='UTC') no_javascript = models.BooleanField(default=False, - help_text="""Disable all JavaScript. Overrides all other JavaScript options.""") + help_text=_("""Disable all JavaScript. Overrides all other JavaScript options.""")) notifications = models.BooleanField(default=True, - help_text="""Display live notifications in header.""") + help_text=_("""Display live notifications in header.""")) click_to_load = models.BooleanField(default=False, - help_text="""Click to load more toots in the same page, rather than using pagination.""") + help_text=_("""Click to load more toots in the same page, rather than using pagination.""")) lightbox = models.BooleanField(default=False, - help_text="""Use a JavaScript lightbox to display media.""") + help_text=_("""Use a JavaScript lightbox to display media.""")) poll_frequency = models.IntegerField(default=300, - help_text="""Number of seconds to wait between checking notifications. Default: 300""") + help_text=_("""Number of seconds to wait between checking notifications. Default: 300""")) class Account(models.Model): username = models.EmailField(unique=True) diff --git a/brutaldon/views.py b/brutaldon/views.py index d8ae5d7..2e283c8 100644 --- a/brutaldon/views.py +++ b/brutaldon/views.py @@ -5,7 +5,7 @@ from django.urls import reverse from django.views.decorators.cache import never_cache, cache_page from django.urls import reverse from django.core.files.uploadhandler import TemporaryFileUploadHandler -from django.utils.translation import gettext as _ +from django.utils.translation import gettext_lazy as _ from brutaldon.forms import LoginForm, OAuthLoginForm, PreferencesForm, PostForm from brutaldon.models import Client, Account, Preference, Theme from mastodon import Mastodon, AttribAccessDict, MastodonError, MastodonAPIError