First time here? Check out the FAQ!
1

url translations

I can't get the new ASKBOT_TRANSLATE_URL to work, using the current master branch. After setting LANGUAGE_CODE = 'de', I expected that all urls will be either all translated or all not translated.

The question url is ok:

  • /question/xyz for ASKBOT_TRANSLATE_URL=False, or
  • /frage/xyz for True.

But the ajax vote url is some half-translated hybrid, in both cases: askbot['urls']['vote_url_template'] = scriptUrl + 'fragen/{{QuestionID}}/vote/';.

And then the POST of course fails, in both cases, so ppl cannot vote. You said you're reworking the language stuff now -- is this some work-in-progress, or am I doing it wrong?

piskvorky's avatar
350
piskvorky
asked 2012-01-06 12:16:22 -0500, updated 2012-01-06 12:58:56 -0500
edit flag offensive 0 remove flag close merge delete

Comments

add a comment see more comments

1 Answer

1

This option currently only toggles translation of urls in the urls.py file.

To do this properly - the check for the ASKBOT_TRANSLATE_URL condition must be added to the templates as well. There are a few places where urls are not inserted into the templates using the {% url %} template tag, that's because the "reverse" function in some cases must be run by javascript, but there is no equivalent for it in js. So we need to solve this problem somehow.

A workaround is - modify all url translations in the django.po and djangojs.po files - anything that has slashes in the key strings, there are not too many of them actually. If you mark those strings as "fuzzy", the translations will be disabled.

Evgeny's avatar
13.2k
Evgeny
answered 2012-01-06 12:27:33 -0500
edit flag offensive 0 remove flag delete link

Comments

So the master branch now won't work, no matter how ASKBOT_TRANSLATE_URL is set?

I fixed/hacked the vote url (I sent a pull request on github) but if there are more problems, I'll probably just revert to an older version of askbot.

piskvorky's avatar piskvorky (2012-01-06 12:31:58 -0500) edit

You'd have to revert to version 30 where this feature was introduced, it would be better to fix it properly though.

Evgeny's avatar Evgeny (2012-01-06 12:47:22 -0500) edit

Created a bug entry for this http://bugs.askbot.org/issues/161

Evgeny's avatar Evgeny (2012-01-06 12:59:07 -0500) edit

Great, thanks Evgeny. Can you answer my questions on the pull request? Maybe I could help if I understand better where the problem is.

piskvorky's avatar piskvorky (2012-01-06 16:06:37 -0500) edit

Note for others: this quick-fix resolves the above issue, but there are other issues with translations, so it's not the whole story yet.

piskvorky's avatar piskvorky (2012-01-07 17:38:02 -0500) edit
add a comment see more comments