12👍
✅
compilemessages
sees the string as “{sitename} is a good website”, but when the app is running the string is actually e.g. “MySite is a good website”, which of course doesn’t have a translation. You must translate the bare string first, and then you can perform template operations on it.
3👍
The following should work:
_('Foo %(x)s') % {'x': "bar"}
s
is the string, d
is the intiger.
👤Zvak
- [Django]-How to server HTTP/2 Protocol with django
- [Django]-How do I deploy Django on AWS?
- [Django]-Alowing 'fuzzy' translations in django pages?
1👍
i had the same problem so i translated the text first and then added the dynamic content like
title = _(u"is a good website")
title = " ".join([website_name, title])
There must be a better way to do this
- [Django]-How to run a celery worker with Django app scalable by AWS Elastic Beanstalk?
- [Django]-__init__() got an unexpected keyword argument 'mimetype'
- [Django]-Duplicate column name
Source:stackexchange.com