I have a model:
class Server(models.Model):
serverId = models.IntegerField(verbose_name=_("serverId"))
name = models.CharField(max_length=200, verbose_name=_("server_name"))
ip = models.CharField(max_length=200, verbose_name=_("ip"))
cport = models.IntegerField(default=5000, verbose_name=_("cport"))
aport = models.IntegerField(default=1000, verbose_name=_("aport"))
hport = models.IntegerField(default=2000, verbose_name=_("hport"))
version = models.CharField(max_length=100, verbose_name=_("version"))
serverGroup = models.ForeignKey(Group, null=True, blank=True,
verbose_name=_('server_group'))
class Meta:
db_table = u'server'
def __unicode__(self):
return self.name
and model shape:
class ServerForm(ModelForm):
class Meta:
model = Server
from this application directory I made
$ mkdir locale
$ django-admin.py makemessages -l zh_CN
then I provided the translation in locale / zh_CN / LC_MESSAGES / django.po then I did
$ django-admin.py compilemessages
then I started the development server:
$ python manage.py runserver
and went on to look at url http://127.0.0.1:8000 in firefox and the displayed translation. So I thought that I did everything right, and I deployed the project on the same computer using nginx + fastcgi, and nothing changed in the whole project. Then I go to the URL http://127.0.0.1 , and then the model model shows English. It is not localized in Chinese.
I googled a lot and read a lot of documents from docs.djangoproject.com and still don't know how to solve the problem. Therefore, I ask here.
LANGUAGE_CODE = 'zh_CN' settings.py deafult. django - 1.2.4
.