| 1 | <?php |
| 2 | /** |
| 3 | * This program is free software; you can redistribute it and/or modify |
| 4 | * it under the terms of the GNU General Public License as published by |
| 5 | * the Free Software Foundation; either version 2 of the License, or |
| 6 | * (at your option) any later version. |
| 7 | * |
| 8 | * This program is distributed in the hope that it will be useful, |
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 | * GNU General Public License for more details. |
| 12 | * |
| 13 | * You should have received a copy of the GNU General Public License along |
| 14 | * with this program; if not, write to the Free Software Foundation, Inc., |
| 15 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 16 | * http://www.gnu.org/copyleft/gpl.html |
| 17 | * |
| 18 | * @file |
| 19 | * @author Ævar Arnfjörð Bjarmason <[email protected]om> |
| 20 | * @license GPL-2.0-or-later |
| 21 | * @license GFDL-1.3-or-later |
| 22 | */ |
| 23 | |
| 24 | use MediaWiki\Language\Language; |
| 25 | |
| 26 | /** |
| 27 | * Belarusian in Taraškievica orthography (Беларуская тарашкевіца) |
| 28 | * |
| 29 | * @ingroup Languages |
| 30 | * @see https://be-tarask.wikipedia.org/wiki/Project_talk:LanguageBe_tarask.php |
| 31 | */ |
| 32 | // phpcs:ignore Squiz.Classes.ValidClassName.NotCamelCaps |
| 33 | class LanguageBe_tarask extends Language { |
| 34 | /** |
| 35 | * The Belarusian language uses apostrophe sign, |
| 36 | * but the characters used for this could be both U+0027 and U+2019. |
| 37 | * This function unifies apostrophe sign in search index values |
| 38 | * to enable search using both apostrophe signs. |
| 39 | * |
| 40 | * @inheritDoc |
| 41 | */ |
| 42 | public function normalizeForSearch( $text ) { |
| 43 | # MySQL fulltext index doesn't grok utf-8, so we |
| 44 | # need to fold cases and convert to hex |
| 45 | |
| 46 | # Replacing apostrophe sign U+2019 with U+0027 |
| 47 | $text = str_replace( "\u{2019}", '\'', $text ); |
| 48 | |
| 49 | return parent::normalizeForSearch( $text ); |
| 50 | } |
| 51 | } |