Repository: wagtail/wagtail

Issue:
Error in Hungarian translation
The new versions have an annoying issue with the Hungarian translations: some of the translation strings are using double quotes instead of single quotes, which causes an arror on the admin page thanks to a faulty JS translation string:

```javascript 
EDIT_PAGE: ""{title}" szerkesztése",
```
The translations are now fixed on Transifex. Since I messed it up, I corrected it - sorry.


Discussion:
@roodie No worries, and thanks for catching this and notifying us promptly! We should really apply JS escaping to these strings so that there are no illegal characters - I'll put together a PR to do that now.

Resolving patch:
diff --git a/wagtail/admin/templatetags/wagtailadmin_tags.py b/wagtail/admin/templatetags/wagtailadmin_tags.py
--- a/wagtail/admin/templatetags/wagtailadmin_tags.py
+++ b/wagtail/admin/templatetags/wagtailadmin_tags.py
@@ -1,4 +1,5 @@
 import itertools
+import json
 
 from django import template
 from django.conf import settings
@@ -15,6 +16,7 @@
 from wagtail.admin.menu import admin_menu
 from wagtail.admin.navigation import get_explorable_root_page
 from wagtail.admin.search import admin_search_areas
+from wagtail.admin.utils import get_js_translation_strings
 from wagtail.core import hooks
 from wagtail.core.models import (
     CollectionViewRestriction, Page, PageViewRestriction, UserPagePermissionsProxy)
@@ -473,3 +475,8 @@ def avatar_url(user, size=50):
             return gravatar_url
 
     return static('wagtailadmin/images/default-user-avatar.png')
+
+
+@register.simple_tag
+def js_translation_strings():
+    return mark_safe(json.dumps(get_js_translation_strings()))
diff --git a/wagtail/admin/utils.py b/wagtail/admin/utils.py
--- a/wagtail/admin/utils.py
+++ b/wagtail/admin/utils.py
@@ -61,6 +61,71 @@
 ]
 
 
+# Translatable strings to be made available to Javascript code
+# as the wagtailConfig.STRINGS object
+def get_js_translation_strings():
+    return {
+        'DELETE': _('Delete'),
+        'PAGE': _('Page'),
+        'PAGES': _('Pages'),
+        'LOADING': _('Loading…'),
+        'NO_RESULTS': _('No results'),
+        'SERVER_ERROR': _('Server Error'),
+        'SEE_ALL': _('See all'),
+        'CLOSE_EXPLORER': _('Close explorer'),
+        'ALT_TEXT': _('Alt text'),
+        'WRITE_HERE': _('Write here…'),
+        'HORIZONTAL_LINE': _('Horizontal line'),
+        'LINE_BREAK': _('Line break'),
+        'UNDO': _('Undo'),
+        'REDO': _('Redo'),
+        'RELOAD_PAGE': _('Reload the page'),
+        'RELOAD_EDITOR': _('Reload saved content'),
+        'SHOW_LATEST_CONTENT': _('Show latest content'),
+        'SHOW_ERROR': _('Show error'),
+        'EDITOR_CRASH': _('The editor just crashed. Content has been reset to the last saved version.'),
+        'BROKEN_LINK': _('Broken link'),
+        'MISSING_DOCUMENT': _('Missing document'),
+        'CLOSE': _('Close'),
+        'EDIT_PAGE': _('Edit \'{title}\''),
+        'VIEW_CHILD_PAGES_OF_PAGE': _('View child pages of \'{title}\''),
+        'PAGE_EXPLORER': _('Page explorer'),
+
+        'MONTHS': [
+            _('January'),
+            _('February'),
+            _('March'),
+            _('April'),
+            _('May'),
+            _('June'),
+            _('July'),
+            _('August'),
+            _('September'),
+            _('October'),
+            _('November'),
+            _('December')
+        ],
+        'WEEKDAYS': [
+            _('Sunday'),
+            _('Monday'),
+            _('Tuesday'),
+            _('Wednesday'),
+            _('Thursday'),
+            _('Friday'),
+            _('Saturday')
+        ],
+        'WEEKDAYS_SHORT': [
+            _('Sun'),
+            _('Mon'),
+            _('Tue'),
+            _('Wed'),
+            _('Thu'),
+            _('Fri'),
+            _('Sat')
+        ]
+    }
+
+
 def get_available_admin_languages():
     return getattr(settings, 'WAGTAILADMIN_PERMITTED_LANGUAGES', WAGTAILADMIN_PROVIDED_LANGUAGES)
 


Test patch: