Не понимаю, почему в шаблоне одна фраза была переведена, а вторая - нет?
В чем может быть проблема?
python manage.py makemessages
python manage.py compilemessages
Настройка
LANGUAGE_CODE = 'ru'
USE_I18N = True
LANGUAGES = (
('ru', gettext('Russian')),
('kk', gettext('Kazakh')),
)
MODELTRANSLATION_DEFAULT_LANGUAGE = 'ru'
TEMPLATES = [
{
'OPTIONS': {
'context_processors': [
'django.template.context_processors.i18n',
'solid_i18n.middleware.SolidLocaleMiddleware',
SOLID_I18N_USE_REDIRECTS = True
1010 * **
шаблон 1012 *
{% load l10n i18n %}
<div>{% trans credit.creditpayment_set.first.security %}</div> #It's translated
<div>{% trans credit.creditpayment_set.first.comission_type %}</div> #It's not translated
django.po (ru)
безопасность
#: credits/models.py:70
msgid "Pledge - real estate"
msgstr "залог - имеющееся недвижимость"
comission_type
#: credits/models.py:156
msgid "For consideration"
msgstr "Комиссия за рассмотрения"
models.py
SECURITY_WITHOUT = 'Without collateral and guarantee'
SECURITY_REAL = 'Pledge - real estate'
SECURITY_CHOICES = (
(SECURITY_WITHOUT, _('Without collateral and guarantee')),
(SECURITY_REAL, _('Pledge - real estate')),
)
class CreditPayment(models.Model):
COMISSION_TYPE_CONSIDERATION = 'for consideration'
COMISSION_TYPE_ORGANIZATION = 'for organization'
COMISSION_TYPE_CHOICES = (
(COMISSION_TYPE_CONSIDERATION, _('For consideration')),
(COMISSION_TYPE_ORGANIZATION, _('For organization')),
)
credit = models.ForeignKey(Credit, on_delete=models.CASCADE)
security = models.CharField(_('security'), max_length=255, choices=SECURITY_CHOICES, default=SECURITY_WITHOUT)
comission_type = models.CharField(_('comission type'), max_length=255, choices=COMISSION_CHOICES, default=COMISSION_MONTHLY, blank=True, null=True)
Потому что COMISSION_TYPE_CHOICES
внутри модели? ..