Add gettext context to tags and warnings, update translations
This commit is contained in:
@@ -21,7 +21,7 @@ import os
|
||||
|
||||
import typing
|
||||
from flask import url_for
|
||||
from flask_babel import lazy_gettext, get_locale, gettext
|
||||
from flask_babel import lazy_gettext, get_locale, gettext, pgettext
|
||||
from flask_sqlalchemy.query import Query
|
||||
from sqlalchemy import or_, func
|
||||
from sqlalchemy.dialects.postgresql import insert
|
||||
@@ -987,8 +987,8 @@ class ContentWarning(db.Model):
|
||||
def get_translated(self):
|
||||
# Translations are automated on dynamic data using `extract_translations.py`
|
||||
return {
|
||||
"title": gettext(self.title),
|
||||
"description": gettext(self.description),
|
||||
"title": pgettext("tags", self.title),
|
||||
"description": pgettext("content_warnings", self.description),
|
||||
}
|
||||
|
||||
def as_dict(self):
|
||||
@@ -1019,8 +1019,8 @@ class Tag(db.Model):
|
||||
def get_translated(self):
|
||||
# Translations are automated on dynamic data using `extract_translations.py`
|
||||
return {
|
||||
"title": gettext(self.title),
|
||||
"description": gettext(self.description) if self.description else "",
|
||||
"title": pgettext("tags", self.title),
|
||||
"description": pgettext("tags", self.description) if self.description else "",
|
||||
}
|
||||
|
||||
def as_dict(self):
|
||||
|
||||
Reference in New Issue
Block a user