Avoid mysterious failures of enchant_broker_request_dict. #7664

Sometimes, that function would just die with no error message. That
seems to have been related to loading the same language dictionary
again, but it took an indeterminite number of repeats to trigger it.

Anyway, I think I have solved the problem by using a cache to ensure we
only load each language once.
Merge branch 'MOODLE_24_STABLE'