-
Notifications
You must be signed in to change notification settings - Fork 38
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
i18n tooling and translation #27
Conversation
700b3ff
to
e3ef8bb
Compare
db709c5
to
2a8f01f
Compare
@mduboseedx Could you please let me know why the |
@OmarIthawi I actually deleted those labels but that may be due to my own confusion with the edx-solutions owner. I can easily add those back though |
Thanks @mduboseedx. I'll tag the latest author on this repo. |
@jmbowman Could you please take a look? or do you know someone else who could review this PR? |
Just a gentle reminder @jmbowman. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the delayed response; still catching up from vacation and hackathon.
CALENDAR_TEMPLATE = "/templates/html/google_calendar.html" | ||
CALENDAR_EDIT_TEMPLATE = "/templates/html/google_calendar_edit.html" | ||
|
||
|
||
def _(text): | ||
""" | ||
Dummy ugettext. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is a stub function being used here instead of the actual ugettext
function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, because XBlocks are initialized as soon as possible and that makes Django freaks out with an exception!
All the other XBlocks uses this trick to overcome this limitation. Honestly, this a pretty useless trick, because XBlocks don't yet support i18n for field name, so 🤷♂️
But everyone's doing this in the hope that we can do something about it soon, I'm also optimistic about that as well so I do the same.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm. Would ugettext_lazy
work? https://docs.djangoproject.com/en/1.11/topics/i18n/translation/#lazy-translation If that breaks something in the depths of the XBlock machinery, I'm fine with this as is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @jmbowman I would love to use an actual ugettext
function, but it's currently not possible.
Last time I checked it with the Poll XBlock it was causing an exception from a function deep down in XBlock. I tried it on the Google Drive and worked, OK.
However, I'm not comfortable with this change, so I'd like to keep it as-is and worry about this problem later. It's not going to be useful anyway since the XBlock fields, to my best knowledge, are instantiated at the class level, so ugettext_lazy
will be as good as ugettext_noop
or my dummy function i.e useless.
e2102db
to
f417e80
Compare
Thanks @jmbowman for the review! I've addressed your comment and added a couple of commits. Could you please take a look? Let me know if you think everything is good so I can squash the commits. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, makes sense.
1764fa4
to
be88f7d
Compare
Thanks @jmbowman! I've squashed the changes. Please feel free to merge. |
Thank you again @jmbowman! |
We'd like to add Japanese as a supported language, also supported JavaScript translations via
django-statici18n
.Before you continue, take a look at edx/i18n-tools and edx/cookiecutter-django-app.
Summary of the Changes
locale
link togoogle_drive/translations
to allow thei18n_tools
find the po/mo filesgoogle_drive/translations/config.yaml
which works as the configuration file of thei18n_tools
commandrequirements-dev.txt
to pin development packages. Used for now only for translations.TODO
django
djangojs
translation domains is ignored because the only string there's is for testing purposeshl=ja_JP
parameter e.g.Screenshot