views:

49

answers:

2

if you using django ,you can use the "LC_MESSAGES -->django.po"

but has any way to do this on gae ?

and how to ..

thanks

and if i only want to use django's this features, how can i import it?

+1  A: 

Try this snippet:

urls.py:

from django.conf import settings
try:
    settings.configure()
except:
    pass
settings.LANGUAGE_CODE = 'zh-tw'
settings.USE_I18N = True
appdir = os.path.abspath( os.path.dirname( __file__ ) )
settings.LOCALE_PATHS = ( 
    os.path.join( appdir, 'locale' ),
 )
from django.utils.translation import *

for each request:

class Page(webapp.RequestHandler):
    def getLanguage(self):
        try:
            language = self.request.cookies['django_language']
            self.locate = language
            logging.info( "Get Language as %s" % self.locate )
        except:
            from django.conf import settings
            self.locate = settings.LANGUAGE_CODE
            logging.info( "Set Language as %s" % self.locate )            
        translation.activate( self.locate )
    def get(self):
        self.getLanguage()
        #...
jbochi
cool~...........
zjm1126
A: 

I had the same question, and it was answered here.

That way I managed to internationalize my GAE app by using standard gettext tools. If your app is open source, you can even enjoy translations on Launchpad!

Emilien