Add gettext context to tags and warnings, update translations

This commit is contained in:
rubenwardy
2024-06-09 13:48:00 +01:00
parent 36644216b2
commit 8b6bd8d282
42 changed files with 36546 additions and 10680 deletions

View File

@@ -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):