Skip to content
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

Merged
merged 6 commits into from
Apr 2, 2015
Merged

Conversation

aronasorman
Copy link
Collaborator

Summary of changes:

  1. Match the KA channel description with that's in the po file (already fixed before, but someone edited it.)
    screen shot 2015-04-02 at 9 35 01 am
  2. i18nize the exercise title (don't mind the exercise text, this is a khan exercise).
    screen shot 2015-04-02 at 9 34 40 am
  3. i18nize the hint button.
    screen shot 2015-04-02 at 9 36 17 am

Remaining issues:

Couldn't i18nize the "Remaining hints" text in the hint button:
screen shot 2015-04-02 at 9 37 13 am

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.

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.
@aronasorman aronasorman added this to the 0.13.0 milestone Apr 2, 2015
@@ -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.

@jamalex
Copy link
Member

jamalex commented Apr 2, 2015

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.
@@ -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.

This comment was marked as spam.

@aronasorman
Copy link
Collaborator Author

Tests pass. Merge!

aronasorman added a commit that referenced this pull request Apr 2, 2015
@aronasorman aronasorman merged commit 73d5ad8 into learningequality:0.13.x Apr 2, 2015
@aronasorman aronasorman removed the has PR label Apr 2, 2015
@aronasorman aronasorman deleted the let_there_be_i18n branch April 2, 2015 19:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants