Add ability to translate tags and content warnings
This commit is contained in:
@@ -906,6 +906,13 @@ class ContentWarning(db.Model):
|
||||
regex = re.compile("[^a-z_]")
|
||||
self.name = regex.sub("", self.title.lower().replace(" ", "_"))
|
||||
|
||||
def get_translated(self):
|
||||
# Translations are automated on dynamic data using `extract_translations.py`
|
||||
return {
|
||||
"title": gettext(self.title),
|
||||
"description": gettext(self.description),
|
||||
}
|
||||
|
||||
def as_dict(self):
|
||||
description = self.description if self.description != "" else None
|
||||
return { "name": self.name, "title": self.title, "description": description }
|
||||
@@ -931,6 +938,13 @@ class Tag(db.Model):
|
||||
regex = re.compile("[^a-z_]")
|
||||
self.name = regex.sub("", self.title.lower().replace(" ", "_"))
|
||||
|
||||
def get_translated(self):
|
||||
# Translations are automated on dynamic data using `extract_translations.py`
|
||||
return {
|
||||
"title": gettext(self.title),
|
||||
"description": gettext(self.description),
|
||||
}
|
||||
|
||||
def as_dict(self):
|
||||
description = self.description if self.description != "" else None
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user