perf(languages): improved js caching of languages by using simplecache

fixes #7458

This replaces the ajax language views which booted the engine every view to only report a 304 not modified... this fix replaces this with just a few milliseconds and a normal cacheable .js file if you use tools like Varnish
Yea... Seems like this is working as intended with the notice. Whitelisting
this use case feels dirty...

I think I'm fine with the current solution for now. The direction I was
thinking we could go in the future is passing the translations via json api
instead of as the raw map you see here...

So all translations needed for the home page could be included in a json
response that also includes all the relevant data for that page. This also
minimizes the number of translations that need to be sent. We're sending
over 1MB right now and 99% is unused. That decision was made by someone --
cough -- a long time ago without concern for mobile performance. I have
since learned the error of my ways and realize we need to do better.

On Tue, Dec 16, 2014, 5:46 AM Jeroen Dalsem <notifications@github.com>
wrote:

> In engine/lib/languages.php
> <https://github.com/Elgg/Elgg/pull/7693#discussion-diff-21897771>:
>
> > @@ -236,3 +236,23 @@ function get_language_completeness($language) {
> >  function get_missing_language_keys($language) {
> >  	return _elgg_services()->translator->getMissingLanguageKeys($language);
> >  }
> > +
> > +/**
> > + * Initializes simplecache views for translations
> > + *
> > + * @return void
> > + */
> > +function _elgg_translations_init() {
> > +	$translations = _elgg_services()->translator->getInstalledTranslations();
> > +	foreach ($translations as $key => $language) {
> > +		// make the js view available for each language
> > +		elgg_extend_view("js/languages/$key.js", "js/languages");
>
> i am still unaware of the reason why we add the original view location to
> an "extended only" view
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/Elgg/Elgg/pull/7693/files#r21897771>.
>