-
Notifications
You must be signed in to change notification settings - Fork 303
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
More i18n fixes #3467
More i18n fixes #3467
Conversation
This is where the actual title is set, not on the exercise view render method. So we put the gettext method here!
Revert back to the string found in the po file.
Ugh. Looks like $._ was a noop, as it just interpolated strings? This time, we actually translate them by passing it into our own gettext method.
@@ -534,8 +534,7 @@ def smart_translate_item_data(item_data): | |||
elif isinstance(field_data, list): | |||
item_data[field] = map(smart_translate_item_data, field_data) | |||
|
|||
|
|||
return item_data | |||
return item_data |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Everything else looks good. After addressing that gettext thing as discussed, feel free to merge. |
Before, we translated based on exercise_lang, whose value is whatever get_best_available_language returns for a given set of languages. However, those set of language choices we pass in are those we have translated exercise templates for. When translating for perseus, this is not the case. So what we do here instead is just localize for whatever language we originally requested for get_exercise_cache in the first place. If it's not there, gettext automatically falls back to English.
This reverts commit 354c2d4.
@@ -165,7 +165,7 @@ def get_exercise_cache(force=False, language=settings.LANGUAGE_CODE): | |||
exercise_template = os.path.join(exercise_lang, exercise_file) | |||
|
|||
|
|||
with i18n.translate_block(exercise_lang): | |||
with i18n.translate_block(language): |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Tests pass. Merge! |
Summary of changes:
Remaining issues:
Couldn't i18nize the "Remaining hints" text in the hint button:
Fixing this properly would require more extensive changes to the perseus codebase, related to integrating Django's and
jed.js
's catalog file. I'm getting there, but I need more time, and I believe this shouldn't be a blocker for 0.13.