First time here? Check out the FAQ!
0

Dynamic askbot translation

Hi, I'm trying to create some buttons (which are flags) on askbot so then when the user click on them, it dynamically translate the forum but it doesn't work so far. Can anyone explain how it works? Thanks.

Cedric's avatar
23
Cedric
updated 2011-10-06 02:57:36 -0500, asked 2011-10-06 02:50:24 -0500
edit flag offensive 0 remove flag close merge delete

Comments

In fact, what I'm trying to do is the same thing as the language bar at the top of this forum (next to the sign out link).

Cedric's avatar Cedric (2011-10-06 02:54:45 -0500) edit
add a comment see more comments

1 Answer

0

For askbot we implemented this just to show that there are translations and there are still two issues - occasionally incorrect display of translations and lack of proper multilingual search.

Source code of askbot site is here https://github.com/ASKBOT/askbot-devel/tree/askbot-site, it is a little out of date, but it is easy to merge with the master branch.

We use an extension called django-localeurl, available here http://pypi.python.org/pypi/django-localeurl/1.4, and at the time we started using this it was necessary to patch some code in askbot, so it is forked.

Also we have the following modifications in the settings:

MIDDLEWARE_CLASSES = (
    #'django.middleware.gzip.GZipMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    #'django.middleware.locale.LocaleMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    #'django.middleware.cache.UpdateCacheMiddleware',
    'askbot_site.middleware.JinjaDjangoLocaleUrlMiddleware',
    'django.middleware.common.CommonMiddleware',
    #'django.middleware.cache.FetchFromCacheMiddleware',
    #'django.middleware.sqlprint.SqlPrintingMiddleware',

    #below is askbot stuff for this tuple$
    'askbot.middleware.anon_user.ConnectToSessionMessagesMiddleware',
    'askbot.middleware.pagesize.QuestionsPageSizeMiddleware',
    'askbot.middleware.cancel.CancelActionMiddleware',
    'django.middleware.transaction.TransactionMiddleware',
    #'debug_toolbar.middleware.DebugToolbarMiddleware',
    'askbot.middleware.view_log.ViewLogMiddleware',
    'askbot.middleware.spaceless.SpacelessMiddleware',
)

Also I have 'localeurl', in my INSTALLED_APPS.

And one more group of settings:

import re
LOCALE_INDEPENDENT_PATHS = (
    re.compile(r'^/m/'),
    re.compile(r'^/rosetta'),
    re.compile(r'^/admin'),
    re.compile(r'^/cache'),
    re.compile(r'^/account/signin'),
    re.compile(r'^/comment/upvote'),
    re.compile(r'^/account/delete_login_method'),
    re.compile(r'^/sitemap\.xml'),
    re.compile(r'^/doc'),
    re.compile(r'^/robots.txt'),
    re.compile(r'^/feeds/rss'),
    re.compile(r'^/upload'),
    re.compile(r'^/followit'),
)

If you have any files missing, please let me know, I'll add them to the repo.

Evgeny's avatar
13.2k
Evgeny
updated 2011-10-06 09:00:06 -0500, answered 2011-10-06 08:14:40 -0500
edit flag offensive 0 remove flag delete link

Comments

Actually I tried it this morning but I still have issues with it... Now there is no more errors but my new problem is that when I click on any link, it tries to go to domain/en/page. The problem is that the server says the page doesn't exists (404 error). If I just remove the /en (domain/en/page -> domain/page), it works but there is still not the translation bar... I guess something is missing in my settings but I don't know what... Can you help please?

Cedric's avatar Cedric (2011-10-06 08:41:09 -0500) edit

Updated my post.

Evgeny's avatar Evgeny (2011-10-06 09:04:50 -0500) edit
add a comment see more comments