(WIP) Studio: Adds Language Selection Menu - #2418
Conversation
|
This work relates to This work also relates to https://github.com/edx/edx-platform/pull/2419 |
There was a problem hiding this comment.
Maybe it is better to use the django's built-in language names rather than define them here?
There was a problem hiding this comment.
At minimum we should just be pulling the options directly from lms/envs/common.py so the menu is consistent with the LMS.
There was a problem hiding this comment.
Totes! This set of fields was just for proofing the rendering and to help suggest how I was expecting the options to be marked up with HTML.
|
@lou-wang, @shnayder, and @cahrens, this proof of concept UI branch/PR has been hanging out for a while (since product had the need to create simple language menus for i8tn work). Can you tell me if this UI is still needed? If so, this branch is static and will need dev support stories to wire up. If not, I'll close this down and delete the branch/work. Thanks for the help in figuring out next steps. (cc'ing @sarina in case she knows more about what's needed for language support these days.) |
|
@talbs we now save the user's language preference in the user preferences model, so the CMS version of language selection should
|
|
Adding @explorerleslie to this thread as well. :) |
|
@explorerleslie, for background, here's the discovery background for this feature (planned for on the LMS side of things as well) - https://edx-wiki.atlassian.net/wiki/pages/viewpage.action?pageId=48726317 |
|
Hey @talbs, @shnayder, you and I should probably talk about this together. I need the broader context for language support in the platform to figure out what to do with this. Do you have a sense of priority? I could set up something for next week, but didn't know if we needed to do something before that. |
|
@explorerleslie I'm hacking on this right now to get it into reviewable/mergable state. It's a much-requested feature from open-source. The brief context is that LMS has a language preference selector, but Studio does not; further, Studio does not respect a language choice you made in the LMS. I think it's actually really close to being good - I've spent about half an hour so far making it respect the LMS language choice, and now it just needs a bit of javascript love as well as some tests. This is a nice-to-have, as it would make language preference more consistent across the whole system (LMS <-> Studio). |
|
@explorerleslie normally I wouldn't work on this but it's Hackathon and it's something I want to see done. Plus I get to learn a bit of Studio code too :) Andy helped me a bit with the Javascript, and it'll need tests and a Studio code review, of course. Just trying to get it in better shape. |
There was a problem hiding this comment.
@andy-armstrong heads up that this form is necessary for Django i18n support -- that's the magic refreshing that enables the translation on the page.
See https://docs.djangoproject.com/en/1.4/topics/i18n/translation/ ; https://github.com/edx/edx-platform/blob/master/lms/templates/modal/_modal-settings-language.html#L29
|
@explorerleslie this is pretty close! I set up a sandbox with this branch at http://studio.sarina.m.sandbox.edx.org/ |
|
Did a bit of testing and there's definitely a missing piece to work out:
I suspect this is related to the call you need to make to i18n/setlang for Django to set your language. A solution would be to re-post to i18n/setlang with your preference on every page -- not sure how much overhead that adds though. |
|
@explorerleslie I think that's just because the button text isn't marked for translation. I have an idea on how to fix the first issue and will take another look tonight. |
|
Did a lot of talking around and it's going to be tough to make this work seamlessly between the LMS & CMS - we need to do some mucking around with the session for the other system to pick up the change made in the first system. Might need to rope in Cale, or Dave, if I can't figure it out. |
|
I'm going to close this PR for now; it's not working, it's not under active development, and I think we need to figure out what we really want to do with it. My understanding is we are going to have a Globalization initiative in the coming quarters, which I will be involved with. Further, I think adding this functionality will also need to tie in with the "language preference" thing we ask for on the Studio registration page - I'm not sure what we do with that info (especially given that you can type in anything arbitrary to that field), or how it relates to this. My feeling is we'll want to consider what we do with that info as a part of this push. |
This works adds a language selection menu to a user's dashboard (per UI/feature request found here - https://edx-wiki.atlassian.net/wiki/pages/viewpage.action?pageId=48726317).
Status: The static assets and styles have been added, but JavaScript to manage the status/editing states as well as submit the form and save the user setting are still needed.