Enable fallback languages when retrieving messages
authorTyler Romeo <tylerromeo@gmail.com>
Wed, 16 Jan 2013 07:28:54 +0000 (23:28 -0800)
committerTyler Anthony Romeo <tylerromeo@gmail.com>
Sun, 26 May 2013 13:46:35 +0000 (15:46 +0200)
commit86b54375de7eb767221b785ba724adaa58cd6d51
tree5255c702ffdb8087ecc336848ace2eaa2a33a572
parentf8099dc3ea6518fb98af72aab99e0360adfaef71
Enable fallback languages when retrieving messages

The core function behind wfMessage() (MessageCache->get()) did not
apply the language fallback chain to on-wiki messages.

This patch has changed the behavior to iterate over all possible
languages, first checking on-wiki and then checking the CDB cache,
until it finds the message. Note that fallback languages never
take precedence over the actual requested language.

This patch was taken from the following changes and then
adjusted to fix issues that caused bug 46579.

* Change-Id: Iaaf6ccebd8c40c9602748c58c3a5c73c29e7aa4d
- Author: Matthew Walker <mwalker@wikimedia.org>
- (cherry picked from commit d434bfcf3bbab05660ed8f798a4622487dd8ba56)
* Change-Id: Ib607a446d3499a3c042dce408db5cbaf12fa9e3d
- Author: Mormegil <mormegil@centrum.cz>
- (cherry picked from commit 1b8cb8dc3119bfb12d86d2f044018dc12553939b)

Bug: 1495
Bug: 46579
Change-Id: I420457863eeb79824698d06abc7784032b267af2
includes/cache/MessageCache.php
languages/Language.php
tests/phpunit/includes/cache/MessageCacheTest.php [new file with mode: 0644]