-
-
Notifications
You must be signed in to change notification settings - Fork 8.8k
Add translation support #607
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Automated message from Dropbox CLA bot @timabbott, it looks like you've already signed the Dropbox CLA. Thanks! |
|
How is the speed of progress of the zulip's i18n? |
|
Well the translations themselves are going well; I haven't had a chance to spend more time debugging the Django translations system since 2 weeks ago. So help debugging this would still be appreciated; I suspect this branch is just missing some piece of configuration. |
|
@timabbott I was able to run the translations without any problem on my jinja2 branch. This is what I did:
|
|
That's great! Sounds like this will be easy once we get the jinja2 piece merged. |
|
Let me give a shot to Django templates as well may be I can find something. |
|
so it's working with django templates as well. I think the problem might be with i18n urls. Can I try on your branch? |
|
Yeah, definitely! If you want to build on top of my branch, you can use |
|
Cool. I have done it manually by doing |
|
yep! Those tools are just a nice way to avoid having to add another user's repo to access the branches in pull requests. |
|
got it. 👍 |
|
@timabbott, I have got it working in https://github.com/umairwaheed/zulip/tree/translations. The only problem is that tests are failing because of the language prefix in the url. |
|
we can either update the tests to use i18n urls or we can disable i18n in testing. |
|
Maybe check using |
|
There are a lot of failures, |
|
OK. Probably best to disable i18n in testing (probably a small tweak to test_settings.py) and we can open an issue enabling it in testing later. |
|
Yep, works now! |
|
Awesome! I'll clean this up (drop the reverted commits, etc.), add some docs, and update the PR. |
|
Cool. |
ac25297 to
7b148b5
Compare
|
@timabbott there is a little problem. If the user is not logged in he is redirected to |
|
Interesting, the issue is probably in zulip_login_required in zerver/decorator.py (we just started forking that and the few functions its calls from what's built-in in Django recently). Can you investigate? |
|
OK, checking it. |
|
I guess the things we need to do to finish this PR are:
|
|
The login bug is fixed :). Just need to append '/' to |
Sure. Let me know if I can work on any of these. (Pushed the fix for login bug to my translations branch) |
|
I think that should be the same; the Travis CI code just runs the scripts under |
|
Checking it. |
There is a limitation we can only use |
|
@timabbott there are few problems I am seeing with this branch. Some static files are not being loaded correctly because the url starts with |
|
@timabbott, it seems that URL regexes are compiled only once and as a result either i18n tests or regular tests fail depending on the value of |
|
Hmm. I wonder if we can do something where we leave the /en/ off the urls.py for the versions of pages in English, so we don't need to break the tests (and existing URLs for English speakers) to have i18n enabled? Would it work to use a similar trick to v1_api_and_json_patterns to put those URL blocks in both a normal patterns and an i18n_patterns ? |
|
I think we can just use the |
|
@timabbott, now i18n works through session, cookie and http header. |
|
I have used your technique to support i18n urls, the backend tests work, the frontend tests fail and the issue with static urls still a problem. |
|
@timabbott this is done. Now we support i18n urls using your technique. All the tests pass as well. |
|
@umairwaheed awesome! What do I need to do to test this manually? Actually maybe it's worth adding documentation on how to do that in a new section on "testing translations" in http://zulip.readthedocs.io/en/latest/translating.html ? |
|
The simplest way to test is to use i18n urls.
Then you can also test by sending |
Sure, doing that now. |
|
@timabbott, I have updated the documentation. |
cbe773d to
460ed75
Compare
|
@umairwaheed I merged half of this branch; I'd like to merge the rest but I've been having issues getting the Transifex API to actually download the latest versions of the I think to finish this project, we should have scripts or otherwise a clear process to do the common workflow elements of managing the translations:
Maybe that's it, but if there are any additional cases, we should have a clear plan for how to handle them. |
|
Cool, @timabbott, I am checking the Transifex API now. |
|
@timabbott, it turns out that there was a typo in |
This supports i18n using all of the following: - I18N urls - Session - Cookie - HTTP header
|
Oh, that was easy, thanks for tracking that down @umairwaheed! I merged everything but the last two commits (which I squashed into one), and tested it out with a few languages the only problem is now that I've cleaned up the duplicate copies of various languages in Transifex, the Chinese translations don't work; any idea what the issue is? |
|
@timabbott, I think this is the reason, apparently, Django uses non-standard language codes for Chinese language. |
|
@timabbott, fixed in umairwaheed/zulip@6405a4e. |
|
Awesome, thanks for tracking that down and finding the clean solution to script this. Merged, thanks for all your work on this @umairwaheed ! |
I'm posting this to enable getting help from others on actually displaying the translations people have been doing on Transifex in Zulip. On this branch you should need to do the following:
./manage.py compilemessagesto build the.mofiles.The Django here are fairly useful: https://docs.djangoproject.com/en/1.8/topics/i18n/translation/