Truncate tag filter descriptions
authorpetarpetkovic <ppetkovic@wikimedia.org>
Wed, 6 Dec 2017 15:59:30 +0000 (16:59 +0100)
committerpetarpetkovic <ppetkovic@wikimedia.org>
Fri, 9 Feb 2018 21:45:20 +0000 (22:45 +0100)
commit2d2575852c01a180ccd75c8a4fa60d8db323eeb6
tree895c218ddad684b6ce04dd3a1d4eb5f8fff53fa6
parent232d76b2428278936d34a5e873e3b6e68bda7da1
Truncate tag filter descriptions

Introduce truncateInternal() method in Language class, based on
existing truncate() method. New method abstracts string truncation,
allowing users to specify callable functions for text length measurement
and string truncation.

New method, truncateInternal(), is used to provide two options for
text truncation:
* For DB usage: truncateForDatabase() method is truncating text by
number of bytes.
* For UI usage: truncateForVisual() method is truncating text by number
of characters, using multibyte string PHP methods.

Old truncate() method is deprecated and just returns the results of
truncateForDatabase() method.

Newly introduced truncateForVisual() method is used for
truncation of long tag descriptions in RCFilters menu.

Bug: T179626
Change-Id: Ib01a8c303304064dde3ce983b817d93a88a5affd
includes/changetags/ChangeTags.php
includes/specialpage/ChangesListSpecialPage.php
languages/Language.php
tests/phpunit/languages/LanguageTest.php