-
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
Hotfix/2729 fetch translated exercises part 2 #3215
Hotfix/2729 fetch translated exercises part 2 #3215
Conversation
…0073e87a2528ef2b1bce918be990299188d41c` into branch.
item_data = json.loads(assessment_item['item_data']) | ||
question_content = _(item_data['question']['content']) | ||
answerarea_content = item_data['answerArea']['options']['content'] | ||
if answerarea_content != "": |
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.
I took quite some time trying to find a perseus exercise that's at least partially translated in KA. Exercise: Linear Algebra -> Unit Vectors Notice the instructions to the right (Fulle die Lucken) Which is present in the assessment item data: So I can confirm that this works. Although @cpauya maybe you have a better example for everyone to see. |
assessment_item['item_data'] = json.dumps(item_data) | ||
|
||
except KeyError: | ||
logging.error("There is something wrong with the format of the assessment items:%s" % KeyError) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Addressed some of mike's issues. Just waiting for tests to pass, and then I'm merging this. |
Hi @aronasorman - thanks for the fixes. Will try to find an exercise and post here with screenshots. We will need these issues merged to central though to get the updated translations: |
@aronasorman Sadly I can't try the exercise you mentioned above because it's greyed-out on my sidebar topics and clicking the entry loads a "Content was not found..." message. I'm waiting for |
@aronasorman - I was able to reproduce your string above (see screenshot) so executing Found the discrepancy between the Sample script from django.utils.translation import activate, ugettext as _
activate("de")
# 1. Sample string to check that we are indeed translating to German.
s = "What is <code>X</code>?"
_(s)
# 2. String from `assessmentitems.json` API call to http://127.0.0.1:8008/api/assessment_item/x83e816580f82fd5f/
s = "Let's count by tens.\n\n![](/content/khan/0dbaca258ebbe4fc6c6c4fb901b9cbc159d09c2b.png)\n\n**What number did we miss?**\n\n \n\n[[\u2603 radio 1]]"
_(s)
# 3. This is the string from the CrowdIn file learn.math.early-math.exercises-de.po:31062
s = "Let's count by tens.\n\n![](https://ka-perseus-graphie.s3.amazonaws.com/0dbaca258ebbe4fc6c6c4fb901b9cbc159d09c2b.png)\n\n**What number did we miss?**\n\n \n\n[[☃ radio 1]]"
_(s) And here's the result >>> from django.utils.translation import activate, ugettext as _
>>>
>>> activate("de")
>>>
>>> # 1. Sample string to check that we are indeed translating to German.
>>> s = "What is <code>X</code>?"
>>> _(s)
'Was ist <code>X</code>?'
>>>
>>> # 2. String from `assessmentitems.json` API call to http://127.0.0.1:8008/api/assessment_item/x83e816580f82fd5f/
>>> s = "Let's count by tens.\n\n![](/content/khan/0dbaca258ebbe4fc6c6c4fb901b9cbc159d09c2b.png)\n\n**What number did we miss?**\n\n \n\n[[\u2603 radio 1]]"
>>> _(s)
u"Let's count by tens.\n\n![](/content/khan/0dbaca258ebbe4fc6c6c4fb901b9cbc159d09c2b.png)\n\n**What number did we miss?**\n\n \n\n[[\\u2603 radio 1]]"
>>>
>>> # 3. This is the string from the CrowdIn file learn.math.early-math.exercises-de.po:31062
>>> s = "Let's count by tens.\n\n![](https://ka-perseus-graphie.s3.amazonaws.com/0dbaca258ebbe4fc6c6c4fb901b9cbc159d09c2b.png)\n\n**What number did we miss?**\n\n \n\n[[☃ radio 1]]"
>>> _(s)
'Lass uns in Zehnerschritten z\xc3\xa4hlen. \n\n ![](https://ka-perseus-graphie.s3.amazonaws.com/0dbaca258ebbe4fc6c6c4fb901b9cbc159d09c2b.png) \n\n **Welche Zahl fehlt?** \n\n\n\n [[\xe2\x98\x83 radio 1]]' Question
Do we have the script or codes that generated the |
Ah. So essentially we can't get the exact string from the mo file, because it differs slightly from what's in assessmentitems.json due to the url. So the best solution in here is to do the same amazon.com to /content url conversion we do with the english assessment strings in the mo file, before we insert the mo file into the language pack. That seems to be a central server issue though. Not sure if we have to change anything here in this PR @cpauya. |
Yes @aronasorman - let's leave this open until fle-internal/ka-lite-central#238 is done and merged then. |
Hi @aronasorman, As what @cpauya hip chat instruction:
I have tried to reproduce the instructions above: but when I was at step 3 and trying to export I got this: I guess my issue #3087 is not necessary since we can now get the latest pot files from |
Let's merge this, so I can test it with the dummy language packs. |
…cises-part-2 Hotfix/2729 fetch translated exercises part 2
Hi @aronasorman - this fixes #2729 with these notes from @jesumer
Central Server Requirements
Distributed Server Requirements
To test
At Central server:
python manage.py update_language_packs -l de --no-srts --no-dubbed --no-kalite-trans --rebuild
command.At Distributed:
python manage.py languagepackdownload -l de --commandline
.de
.To test thru the Python shell
This is taken from fle-internal/ka-lite-central#226 (comment)
Which should display this:
References:
What is <code>X</code>?
text as per example above.