learningequality / ka-lite

KA Lite: lightweight web server for serving core Khan Academy content (videos and exercises) without needing internet connectivity
https://learningequality.org/ka-lite/
Other
458 stars 305 forks source link

Locale problem - subtitles & exercises not loading #4027

Closed radinamatic closed 9 years ago

radinamatic commented 9 years ago

Branch: 0.14.x

Current Behavior: Spanish locale (unsure about others) is not showing properly. At first I noticed errors about \content\locale\js\i18n\es.js (file is actually there on my HD):

es js-not-loading

On updating the Spanish language pack, got some 404 errors and the WARNING:kalite:No es_icu.js file found in locale_path d:\github15\KA\ka-lite\locale/, not sure if it's relevant. This was the command line output during the update:

[05/Jul/2015 17:42:23] "GET /_generated/dynamic.css HTTP/1.1" 200 70
[05/Jul/2015 17:42:23] "GET /_generated/dynamic.js HTTP/1.1" 200 354
[05/Jul/2015 17:42:23] "GET /static/js/control_panel/zone_management.js HTTP/1.1" 200 1234
[05/Jul/2015 17:42:23] "GET /content/locale/js/i18n/es.js HTTP/1.1" 404 839
[05/Jul/2015 17:42:23] "GET /handlebars/templates/search.js HTTP/1.1" 200 415
[05/Jul/2015 17:42:23] "GET /handlebars/templates/user.js HTTP/1.1" 200 1424
[05/Jul/2015 17:42:23] "GET /jsreverse/ HTTP/1.1" 200 4643
[05/Jul/2015 17:42:24] "GET /content/locale/js/i18n/es.js HTTP/1.1" 404 839
[05/Jul/2015 17:42:25] "GET /static/js/jquery.min.map HTTP/1.1" 404 1658
[05/Jul/2015 17:42:26] "GET /static/js/jquery.qtip.min.js.map HTTP/1.1" 404 1682

[05/Jul/2015 17:42:26] "GET /securesync/api/user/status/?_=1436110944118 HTTP/1.1" 200 326
[05/Jul/2015 17:42:28] "GET /update/languages/ HTTP/1.1" 200 4126
[05/Jul/2015 17:42:29] "GET /_generated/dynamic.css HTTP/1.1" 200 70
[05/Jul/2015 17:42:29] "GET /static/css/updates/base.css HTTP/1.1" 200 492
[05/Jul/2015 17:42:29] "GET /static/css/updates/update_languages.css HTTP/1.1" 200 2200
[05/Jul/2015 17:42:29] "GET /_generated/dynamic.js HTTP/1.1" 200 354
[05/Jul/2015 17:42:29] "GET /content/locale/js/i18n/es.js HTTP/1.1" 404 839
[05/Jul/2015 17:42:29] "GET /handlebars/templates/search.js HTTP/1.1" 200 415
[05/Jul/2015 17:42:29] "GET /handlebars/templates/user.js HTTP/1.1" 200 1424
[05/Jul/2015 17:42:29] "GET /static/js/updates/base.js HTTP/1.1" 200 9261
[05/Jul/2015 17:42:29] "GET /static/js/updates/update_languages.js HTTP/1.1" 200 13260
[05/Jul/2015 17:42:29] "GET /jsreverse/ HTTP/1.1" 200 4643
[05/Jul/2015 17:42:29] "GET /content/locale/js/i18n/es.js HTTP/1.1" 404 839
[05/Jul/2015 17:42:31] "GET /static/js/jquery.min.map HTTP/1.1" 404 1658
[05/Jul/2015 17:42:31] "GET /static/js/jquery.qtip.min.js.map HTTP/1.1" 404 1682

[05/Jul/2015 17:42:32] "GET /api/languagepacks/installed?_=1436110949863 HTTP/1.1" 200 374
[05/Jul/2015 17:42:32] "GET /securesync/api/user/status/?_=1436110949860 HTTP/1.1" 200 326
[05/Jul/2015 17:42:34] "GET /securesync/api/info?fields=online&_=1436110949864 HTTP/1.1" 200 54
[05/Jul/2015 17:42:34] "GET /api/updates/progress?process_name=languagepackdownload&_=1436110949865 HTTP/1.1" 200 2
[05/Jul/2015 17:42:34] "GET /api/updates/progress?process_name=languagepackdownload&_=1436110949866 HTTP/1.1" 200 2
[05/Jul/2015 17:42:35] "GET /api/updates/progress?process_name=languagepackdownload&start_time=2015-07-05T15:42:34.000Z&_=1436110949867 HTTP/1.1" 200 2
d:\github15\KA\ka-lite\python-packages\django\http\request.py:193: DeprecationWa
rning: HttpRequest.raw_post_data has been deprecated. Use HttpRequest.body inste
ad.
  warnings.warn('HttpRequest.raw_post_data has been deprecated. Use HttpRequest.
body instead.', DeprecationWarning)

WARNING:py.warnings:d:\github15\KA\ka-lite\python-packages\django\http\request.p
y:193: DeprecationWarning: HttpRequest.raw_post_data has been deprecated. Use Ht
tpRequest.body instead.
  warnings.warn('HttpRequest.raw_post_data has been deprecated. Use HttpRequest.
body instead.', DeprecationWarning)

[05/Jul/2015 17:42:35] "POST /api/languagepacks/start HTTP/1.1" 200 84
[05/Jul/2015 17:42:35] "GET /api/updates/progress?process_name=languagepackdownl
oad&_=1436110949868 HTTP/1.1" 200 2
INFO:kalite:Downloading language pack for lang_name=Espa├▒ol, Castellano, softwa
re_version=0.14
INFO:kalite:Downloading language pack 'es'
INFO:kalite:Retrieving language pack: es
INFO:kalite:Unpacking language pack 'es'
INFO:kalite:Unpacking new translations
INFO:kalite:Creating static files for language pack 'es'
WARNING:kalite:No es_icu.js file found in locale_path d:\github15\KA\ka-lite\loc
ale/
INFO:kalite:Writing i18nized js file to d:\github15\KA\ka-lite\content\locale\js
\i18n\es.js
INFO:kalite:Moving files to their appropriate local disk locations.
INFO:kalite:Moving 426 downloaded exercises to d:\github15\KA\ka-lite\exercises\
es
INFO:kalite:Moving 2895 subtitles from d:\github15\KA\ka-lite\locale\es\subtitle
s to d:\github15\KA\ka-lite\kalite\static\srt\es\subtitles
INFO:kalite:Removing empty source directory (d:\github15\KA\ka-lite\locale\es\su
btitles).
INFO:kalite:Invalidate caches
INFO:kalite:Preloading exercise data for language en.
INFO:kalite:Preloading content data for language en.
INFO:kalite:Preloading topic tree data for language en.
INFO:kalite:Preloading exercise data for language es.
INFO:kalite:Preloading content data for language es.
INFO:kalite:Preloading topic tree data for language es.
INFO:kalite:Finished processing language pack Español, Castellano.
[05/Jul/2015 17:46:07] "GET /api/updates/progress?process_id=23&_=1436110949975
HTTP/1.1" 200 195
[05/Jul/2015 17:46:07] "GET /api/languagepacks/installed?_=1436110949976 HTTP/1.
1" 200 380

Exercises that in the sidebar appear to be available, fail to load:

exercises-not-loading

Subtitles (both English & Spanish), that are present in the \kalite\static\srt\es\subtitles and \kalite\static\srt\en\subtitles also fail to load:

subtitles-not-loading

CC button is visible in the video player control bar, which suggests it's a different problems from the one we had in #3831 that prevents subtitles from loading.

Steps to reproduce:

  1. Log in as Admin and download Spanish language pack. Logout.
  2. Login as Learner and try to see some videos & exercises in Spanish.
radinamatic commented 9 years ago

Retesting the scenario with French locale gave similar results, but no error on loading the: [05/Jul/2015 19:39:42] "GET /content/locale/js/i18n/fr.js HTTP/1.1" 200 1453

As above, CC button is visible in the video player control bar, it lists the supposedly available captions, but none can actually be loaded, despite being present in the respective \kalite\static\srt\<locale>\subtitles folder:

fr-subtitles-not-loading

benjaoming commented 9 years ago

Loading new static items like subtitle files that have just been downloaded require that you have restarted the server. That's because the server runs collectstatic during initialization.

Can you verify if the results indeed the same after restarting?

radinamatic commented 9 years ago

Indeed, the subs appeared after restarting the server... :+1:

I would recommend giving stronger emphasis on the server restart requirement in the documentation then what it has now ("if you feel the need to reboot" or "you may want to restart your server"). If subtitles cannot be seen without restarting, then it is a MUST. I will try to add a PR to that effect tomorrow.

benjaoming commented 9 years ago

Yes, this should be a very visible message.

Missing instructions for server restart should be a blocking issue, because it restarting the server because of adding subtitles is absolutely not intuitive!!

I replaced this issue with #4034 to make it a bit shorter to read :)

benjaoming commented 9 years ago

Btw nice debugging!!! Thanks for the data, it made it very easy to spot that it was an issue with the static files. :+1:

radinamatic commented 9 years ago

Yeah, it figures it would make it easier for you guys to pinpoint the 'whys', if we spell out all the details of 'whats' and 'hows'... ;)