PDF editor: Allow multi-lingual text

This commit is contained in:
Raphael Michel
2022-03-13 15:06:18 +01:00
committed by Raphael Michel
parent 02f8bcbe23
commit ebae275a2d
3 changed files with 35 additions and 2 deletions

View File

@@ -55,6 +55,7 @@ from django.utils.functional import SimpleLazyObject
from django.utils.html import conditional_escape
from django.utils.timezone import now
from django.utils.translation import gettext_lazy as _
from i18nfield.strings import LazyI18nString
from PyPDF2 import PdfFileReader
from pytz import timezone
from reportlab.graphics import renderPDF
@@ -660,8 +661,11 @@ class Renderer:
if not o['content']:
return '(error)'
if o['content'] == 'other':
text = o['text']
if o['content'] == 'other' or o['content'] == 'other_i18n':
if o['content'] == 'other_i18n':
text = str(LazyI18nString(o['text_i18n']))
else:
text = o['text']
def replace(x):
if x.group(1) not in self.variables: