Fixed #21473 -- Limited language preservation to logout

Current language is no longer saved to session by LocaleMiddleware
on  every response (the behavior introduced in #14825).
Instead language stored in session is reintroduced into new session
after logout.

Forward port of c558a43fd6 to master.
Fixed #21591 -- Added documentation about contrib.messages.get_messages.

Refs https://code.djangoproject.com/ticket/21591
Thanks to track user merb for the report.
Improved translation maintenance script

Do not fetch 'en' catalogs, neither files with translation stats
lower than 5%. Centralized resource filtering.
Moving notes for assertNumQueries next to the other changes to test infrastructure
Fixed PEP257 violations (single-quoted docstrings) in utils.text.
Fixed #21574 -- Handle bytes consistently in utils.text.normalize_newlines.

All input is now coerced to text before being normalized.
This changes nothing under Python 2 but it allows bytes
to be passed to the function without a TypeError under Python3
(bytes are assumed to be utf-8 encoded text).

Thanks to trac user vajrasky for the report.
Copied 1.6.1 release notes from stable/1.6.x branch.
Changed documentation of HttpResponse.content to indicate it's a bytestring
Merge pull request #2067 from dominicrodger/master

Moving notes for assertNumQueries next to the other changes to test infrastructure
Moved django.db.models.loading to django.apps.cache.

This commit doesn't contain any code changes; it's purely a refactoring.
Removed BaseAppCache.app_store.

It was only storing redundant information. This is part of the effort to
allow applications without a models module.
Removed ModelDict.

Its only difference with OrderedDict is that it didn't deepcopy its
keys. However it wasn't used anywhere with models modules as keys, only
as values. So this commit doesn't result in any change in functionality.
Removed model-level functions for the app cache.

Since the original ones in django.db.models.loading were kept only for
backwards compatibility, there's no need to recreate them. However, many
internals of Django still relied on them.

They were also imported in django.db.models. They never appear in the
documentation, except a quick mention of get_models and get_app in the
1.2 release notes to document an edge case in GIS. I don't think that
makes them a public API.

This commit doesn't change the overall amount of global state but
clarifies that it's tied to the app_cache object instead of hiding it
behind half a dozen functions.
Stored AppConfig objects instead of models modules in the app cache.

This is a step towards allowing applications without a models module.
Removed unused attribute app_errors of the app cache.

get_app_errors() always returned an empty dictionary; this behavior is
preserved in django.db.models.loading until that module is deprecated.
Moved list of models inside AppConfig instances.

This commit is a refactoring with no change of functionality, according
to the following invariants:

- An app_label that was in app_configs and app_models stays in
  app_config and has its 'installed' attribute set to True.

- An app_label that was in app_models but not in app_configs is added to
  app_configs and has its 'installed' attribute set to True.

As a consequence, all the code that iterated on app_configs is modified
to check for the 'installed' attribute. Code that iterated on app_models
is rewritten in terms of app_configs.

Many tests that stored and restored the state of the app cache were
updated.

In the long term, we should reconsider the usefulness of allowing
importing models from non-installed applications. This doesn't sound
particularly useful, can be a trap in some circumstances, and causes
significant complexity in sensitive areas of Django.
Fleshed out AppConfig objects.

Marginally improved creation of AppConfig stubs for non-installed apps.
Added a method to look up app configs by label.
Added a method to iterate on app_config instances.
Deprecated get_app_package and get_app_path.