tags:

views:

35

answers:

0

I have done django internationalization.My application is working fine.I am missing something in my settings.py file .If i change the locale of my browser the django admin text is changing but my code text is not changing.But if i write language_code="ja-JP" then my text is also changing but this is wrong way.Below is my sample settings file.I am using django1.2 final and ubuntu 9.04

 #settings.py

 gettext_noop = lambda s: s

 DEBUG = True
 TEMPLATE_DEBUG = DEBUG

 ADMINS = (
    # ('Your Name', '[email protected]'),
  )

 # Default content type and charset to use for all HttpResponse objects, if a
 # MIME type isn't manually specified. These are used to construct the
 # Content-Type header.
 DEFAULT_CONTENT_TYPE = 'text/html'
  DEFAULT_CHARSET = 'utf-8'

  # Encoding of files read from disk (template and initial SQL files).
  FILE_CHARSET = 'utf-8'

  MANAGERS = ADMINS

  DATABASE_ENGINE = 'postgresql_psycopg2'            # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlitea3' or 'oracle'.a
  DATABASE_NAME = 'jp'                            # Or path to database file    if using sqlite3.a
 DATABASE_USER = ''                       # Not used with sqlite3.
 DATABASE_PASSWORD =''            # Not used with sqlite3.
 DATABASE_HOST = '127.0.0.1'          # to empty string for localhost. Not used with sqlite3.
DATABASE_PORT = '5488'                   # Set to empty string for default. Not used with sqlite3.


 TIME_ZONE = 'UTC'

  LANGUAGE_CODE ='en-US'

 # Languages we provide translations for, out of the box. The language name
 # should be the utf-8 encoded local name for the language.
 LANGUAGES = (
       ('en', gettext_noop('English')),
       ('ja', gettext_noop('Japanese')),
       ('hi', gettext_noop('Hindi')),

  )

 LOCALE_PATHS = ('/opt/var/django/locale/ja/',
            '/opt/var/django/locale/hi/',
            '/var/lib/python-support/python2.5/django/conf/locale/en/',
            '/var/lib/python-support/python2.5/django/conf/locale/ja/',
            '/var/lib/python-support/python2.5/django/conf/locale/hi/',

            )

  LANGUAGE_COOKIE_NAME = 'django_language'


  SITE_ID = 1



  MIDDLEWARE_CLASSES = (
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.locale.LocaleMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',

    )