Fixed fallback behaviour for plural rules
authorTim Starling <tstarling@wikimedia.org>
Tue, 28 Aug 2012 05:54:40 +0000 (15:54 +1000)
committerNiklas Laxström <niklas.laxstrom@gmail.com>
Wed, 29 Aug 2012 07:57:45 +0000 (07:57 +0000)
commitd76e670c7694773c0779cc51e684ed70f2cd4f3b
treec0d6f4e4ec8dae4f748d7a15346ecd5a20564548
parentad03f2f7536f28bd2cf1eefa2cf3cbc14b392bef
Fixed fallback behaviour for plural rules

Fallbacks didn't work at all for the new plural rule system. I fixed it
by moving the getPluralRules() and getCompiledPluralRules() calls near
to the readPHPFile() calls, before merging is done. Then I factored out
the resulting code to readSourceFilesAndRegisterDeps().

* Removed pluralRules from mergeableMapKeys, it isn't one
* Added compiledPluralRules to allKeys so that it will be merged
* When a language is not present in the CLDR XML files, return null from
  getPluralRules() and getCompiledPluralRules() so that the fallback
  rules won't be overridden with an empty array. Normalised it back to
  an empty array in the unlikely event that there is no plural data in
  the fallback sequence at all, even in English.
* Fixed private function, "protected" is the way to say private here.

Change-Id: I3a008ef7f6ed7aaa15ad25ad796f7a2b8f827fa2
includes/LocalisationCache.php
tests/phpunit/includes/LocalisationCacheTest.php [new file with mode: 0644]