Ask Your Question
0

Dynamic askbot translation

asked Oct 06 '11

Cedric gravatar image Cedric
23 1 4

updated Oct 06 '11

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.

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 (Oct 06 '11)

1 Answer

Sort by » oldest newest most voted
0
Cedric has selected this answer as correct

answered Oct 06 '11

Evgeny gravatar image Evgeny flag of Chile
6715 31 49 96
http://askbot.org/

updated Oct 06 '11

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.

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 (Oct 06 '11)

Updated my post.

Evgeny (Oct 06 '11)

Your answer

Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!
[hide preview]

Question tools

Follow

subscribe to rss feed

Stats

Asked: Oct 06 '11

Seen: 62 times

Last updated: Oct 06 '11