Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4005190
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T08:21:51+00:00 2026-05-20T08:21:51+00:00

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

  • 0

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 the modelform:

class ServerForm(ModelForm):
    class Meta:
        model = Server

from within this app directory I did

$ 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 ran the development server:

$ python manage.py runserver

and went to look at the url http://127.0.0.1:8000 in firefox and the translation displayed. So I thought I did right and I deployed the project on the same machine using nginx + fastcgi with nothing changed in the whole project. Then I go to the url http://127.0.0.1, and then the the modelform shows English there. It didn’t localize to Chinese.

I’ve googled much and read many docs from docs.djangoproject.com and still don’t know how to solve the problem. So I ask here.

I only set LANGUAGE_CODE = ‘zh_CN’ in my settings.py and leave everything on deafult. My django version is 1.2.4

Any of your comments are appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T08:21:52+00:00Added an answer on May 20, 2026 at 8:21 am

    Make sure you are using lazy_translation. Are you importing ugettext_lazy or ugettext?

    from django.utils.translation import ugettext_lazy as _
    

    http://docs.djangoproject.com/en/dev/topics/i18n/internationalization/#lazy-translation

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a model like this: class database(models.Model): db_name = models.CharField('Name', max_length=20) server =
I have a following model: class Car(models.Model): make = models.CharField(max_length=40) mileage_limit = models.IntegerField() mileage
I have class Cab(models.Model): name = models.CharField( max_length=20 ) descr = models.CharField( max_length=2000 )
I have models (simplified example): class Group(models.Model): name = models.CharField(max_length = 32) class Person(models.Model):
I have the following model class Command(models.Model): server = models.ForeignKey(Server) user_login = models.CharField(max_length=100) user_run
Let's say I have the following model: class Contest: title = models.CharField( max_length =
I have a model with articles, events and people: class Person(models.Model): id = models.IntegerField(primary_key=True)
Given: from django.db import models class MyModel(models.Model): ... owners = models.CharField(max_length=255, blank=False) where owners
Hay, i have a model which saves 2 images class Picture(models.Model): picture = models.ImageField(upload_to=make_filename)
I have this Task model: class Task < ActiveRecord::Base acts_as_tree :order => 'sort_order' end

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.