Make Language::formatTimePeriod() more flexible so it can produce stuff like '3 hours...
authorRoan Kattouw <catrope@users.mediawiki.org>
Fri, 23 Sep 2011 22:17:10 +0000 (22:17 +0000)
committerRoan Kattouw <catrope@users.mediawiki.org>
Fri, 23 Sep 2011 22:17:10 +0000 (22:17 +0000)
commite5a9b38294da994f41ac568a16cd5cf4f0bdaf36
tree0cc02053f614a7118bd1eef7962aece5374b7ab2
parente9e287d1de9592b84e27e8346217651369c23226
Make Language::formatTimePeriod() more flexible so it can produce stuff like '3 hours ago'.

* Add a $noAbbrevs parameter that causes the 'seconds', 'minutes', etc. messages to be used instead of the 'seconds-abbrev', 'minutes-abbrev', etc. messages
* Add the 'seconds', 'minutes', 'hours' and 'days' messages
* Change the -abbrev messages to take a parameter rather than having the number prepended to them. This is for compatibility with 'seconds' et al, which need the parameter for {{PLURAL:}}. It also generally makes more sense. This does BREAK the messages in non-English languages that override them; Niklas told me to leave this alone and ping the TranslateWiki folks
* Introduce an 'ago' message for '$1 ago'. Not currently used in core, but I want to use it in an extension and it seemed stupid not to have such a thing in core.
* Refactor the function to use message objects and pass the number as a parameter
* Add tests! They exposed a subtle bug in my first iteration; all hail tests!
languages/Language.php
languages/messages/MessagesEn.php
tests/phpunit/languages/LanguageTest.php