Repository: learningequality/kolibri

Issue:
Allow site title to be customised
## Overview

Allow the site title to be customised; it’s currently hardcoded as ‘Kolibri’.

#### Description and outcomes

The site title is used in only a few places: the `<title>` of the base page and the ‘unsupported browser’ page, and the name in the PWA manifest.

Almost all of the time, the title is overridden by the plugin being used, via vuejs, so users will typically see something like ‘Explore’ or ‘Library’ instead of ‘Kolibri’.

The place where the default ‘Kolibri’ title is slightly problematic at the moment is in the PWA plugin: the name of the PWA is set to ‘Kolibri’, and that’s shown much more prominently in the browser’s list of PWA apps, or on the desktop app chooser when trying to run it.

For Endless Key in particular, that’s a bit problematic because users will likely try to find the PWA from their desktop by searching for ‘Endless Key’ rather than ‘Kolibri’.

So it would be good to either be able to:
 - Separate the site title from the name of the platform (which will always be Kolibri), and allow the site title to be customised.
 - Or, specifically set the site title in the configuration for the PWA plugin.

The second option is much more self-contained, but doesn’t seem semantically correct to me. The PWA manifest should be reflecting the main site’s configuration.

#### Resources

 - https://developer.mozilla.org/en-US/docs/Web/Manifest/name
 - https://developer.mozilla.org/en-US/docs/Web/Manifest/short_name

#### Accessibility Requirements

Having an installed PWA use the name the users will be most familiar with it seems like an accessibility issue, although I have not been approaching it from that angle and don’t know which specific accessibility spec applies here.


Discussion:
Richard says he has a spec in mind for this, and it has a few subtleties to consider. He has not had a chance to write it up so far yet though.
As a first easy step towards this, perhaps I could put a PR together which:
 * Adds `OPTIONS['Deployment']['SITE_TITLE']` to set the human readable site title
 * Uses it in the PWA plugin
 * Leaves changing the `<title>` for other pages, the unsupported browser page, etc. alone if that is the area where the subtleties lie?

Unless you think the subtleties are to do with storing a human-readable name as a configuration option? I was thinking that since it’s a proper name, it wouldn’t need translating — but actually I guess it would benefit from transliterating into other scripts for localisation into Cyrillic, for example.
Yes, that's precisely why this needs slightly more careful speccing. I should have time for this this week.

Resolving patch:
diff --git a/kolibri/core/templatetags/core_tags.py b/kolibri/core/templatetags/core_tags.py
--- a/kolibri/core/templatetags/core_tags.py
+++ b/kolibri/core/templatetags/core_tags.py
@@ -14,6 +14,7 @@
 from kolibri.core.hooks import FrontEndBaseHeadHook
 from kolibri.core.hooks import FrontEndBaseSyncHook
 from kolibri.core.theme_hook import ThemeHook
+from kolibri.utils.translation import ugettext as _
 
 register = template.Library()
 
@@ -71,3 +72,13 @@ def theme_favicon():
     favicon_url = favicon_urls[0] if favicon_urls else static("assets/logo.ico")
 
     return format_html('<link rel="shortcut icon" href="{}">', favicon_url)
+
+
+@register.simple_tag()
+def site_title():
+    """
+    Return the text of the site title, if provided by the theme. If not, the
+    default will be returned. The site title may be translated, to allow for
+    transliteration into other alphabets where needed.
+    """
+    return ThemeHook.get_theme().get("siteTitle", _("Kolibri"))


Test patch: