Repository: learningequality/kolibri

Issue:
Frontend translations only get applied the moment one starts typing
Branch: latest 0.3.x

![bug](https://cloud.githubusercontent.com/assets/191955/24059711/4852a44c-0b0d-11e7-9f6c-335a855c0348.gif)

Text intially starts in English, even with another language set. Typing then switches it to the said language.





Discussion:
Does this only happen on the login page?
Yup! 

Resolving patch:
diff --git a/kolibri/content/hooks.py b/kolibri/content/hooks.py
--- a/kolibri/content/hooks.py
+++ b/kolibri/content/hooks.py
@@ -83,11 +83,11 @@ def render_to_page_load_async_html(self):
         :returns: HTML of a script tag to insert into a page.
         """
         urls = [chunk['url'] for chunk in self.bundle]
-        tags = ['<script>{kolibri_name}.registerContentRenderer("{bundle}", ["{urls}"], {content_types});</script>'.format(
-            kolibri_name=django_settings.KOLIBRI_CORE_JS_NAME,
-            bundle=self.unique_slug,
-            urls='","'.join(urls),
-            content_types=json.dumps(self._content_type_json),
-        )]
-        tags += self.frontend_message_tag()
+        tags = self.frontend_message_tag() +\
+            ['<script>{kolibri_name}.registerContentRenderer("{bundle}", ["{urls}"], {content_types});</script>'.format(
+                kolibri_name=django_settings.KOLIBRI_CORE_JS_NAME,
+                bundle=self.unique_slug,
+                urls='","'.join(urls),
+                content_types=json.dumps(self._content_type_json),
+            )]
         return mark_safe('\n'.join(tags))
diff --git a/kolibri/core/webpack/hooks.py b/kolibri/core/webpack/hooks.py
--- a/kolibri/core/webpack/hooks.py
+++ b/kolibri/core/webpack/hooks.py
@@ -259,7 +259,7 @@ def render_to_page_load_sync_html(self):
         :param bundle_data: The data returned from
         :return: HTML of script tags for insertion into a page.
         """
-        tags = list(self.js_and_css_tags()) + self.frontend_message_tag()
+        tags = self.frontend_message_tag() + list(self.js_and_css_tags())
 
         return mark_safe('\n'.join(tags))
 
@@ -279,14 +279,14 @@ def render_to_page_load_async_html(self):
         :returns: HTML of a script tag to insert into a page.
         """
         urls = [chunk['url'] for chunk in self.bundle]
-        tags = ['<script>{kolibri_name}.registerKolibriModuleAsync("{bundle}", ["{urls}"], {events}, {once});</script>'.format(
-            kolibri_name=django_settings.KOLIBRI_CORE_JS_NAME,
-            bundle=self.unique_slug,
-            urls='","'.join(urls),
-            events=json.dumps(self.events),
-            once=json.dumps(self.once),
-        )]
-        tags += self.frontend_message_tag()
+        tags = self.frontend_message_tag() +\
+            ['<script>{kolibri_name}.registerKolibriModuleAsync("{bundle}", ["{urls}"], {events}, {once});</script>'.format(
+                kolibri_name=django_settings.KOLIBRI_CORE_JS_NAME,
+                bundle=self.unique_slug,
+                urls='","'.join(urls),
+                events=json.dumps(self.events),
+                once=json.dumps(self.once),
+            )]
         return mark_safe('\n'.join(tags))
 
     class Meta:


Test patch: