Hi,
I tried to register to http://pylonshq.com and report a bug. But the
gmail put the register verification mail to the spam folder, when I
found that, it was expired. When I tried login, I always got a "You
must verify your email before signing in." error message, I got no way
to contact the administrator of that site, the "Contact
Administrators" under the page is invalid. My email is
bornstub (at) gmail.com
Could someone help me?
Back to the topic, I notice that Pylons can't detects the language by
Accept-Language field in http hedaer. Languages sent by browser are
always in
zh-tw
zh-cn
en-us
form. And I traced into the Pylons code, it just pass those languages
to gettext of Python. Here comes the problem, the gettext of Python
can recognize languages in zh_tw form but not zh-tw. For solving this
problem temporary, I wrote a middleware for replacing the "-" with
"_". Here is the code:
class LanguageWorkaround(object):
"""Workaround middleware for languages in dash form problem
gettext can't recognize that form, for example, it can recognize
'zh_tw' rather than zh-tw, so we need to replace all dash to
underscore to fix this problem
"""
def __init__(self, app):
self.app = app
def __call__(self, environ, start_response):
# we replace "-" with "_", so that python gettext can
recognize the
# name of language correctly
key = 'HTTP_ACCEPT_LANGUAGE'
if environ.get(key):
environ[key] = environ[key].replace('-', '_')
return self.app(environ, start_response)
Could someone submit a ticket for me?
I hope this could be helpful :P
Regards.
Victor Lin.
--
You received this message because you are subscribed to the Google Groups
"pylons-discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/pylons-discuss?hl=en.