fix: 修改翻译 (#7526)

* fix: 修改翻译

* fix: 修改保存数据库翻译

* fix: 修复翻译为none问题

Co-authored-by: feng626 <1304903146@qq.com>
Co-authored-by: Jiangjie.Bai <32935519+BaiJiangJie@users.noreply.github.com>
This commit is contained in:
fit2bot
2022-01-18 19:31:01 +08:00
committed by GitHub
parent 8d6498c8f0
commit 0b16d70c0c
4 changed files with 87 additions and 60 deletions

View File

@@ -0,0 +1,14 @@
from django.utils.translation import gettext
def translate_value(value):
if not value:
return value
sps = ['. ', ': ']
spb = {str(sp in value): sp for sp in sps}
sp = spb.get('True')
if not sp:
return value
tpl, data = value.split(sp, 1)
return gettext(tpl + sp) + data