mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/Vector.git
synced 2024-12-11 23:46:22 +00:00
e46eef19d0
- `MediaWiki\Skins\Vector\Tests` is now the prefix for all tests in the skin - we followed PSR conventions of following folder structure after the prefix - Optimize imports/use order - update namespace in skin.json Bug: T303102 Change-Id: Ib76374d81d973c83adfd6c8e7863ff6d797e655d
46 lines
1.1 KiB
PHP
46 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace MediaWiki\Skins\Vector\Services;
|
|
|
|
class LanguageService {
|
|
/**
|
|
* The list of language codes for those languages that the search autocomplete widget cannot
|
|
* split a word on a Unicode code point followed by one or many combining marks (also code
|
|
* points).
|
|
*
|
|
* This list was compiled by [@TJones](https://phabricator.wikimedia.org/p/TJones/) as part
|
|
* of [T281797](https://phabricator.wikimedia.org/T281797).
|
|
*
|
|
* @var string[]
|
|
*/
|
|
private $splittableLanguages;
|
|
|
|
public function __construct() {
|
|
$this->splittableLanguages = [
|
|
'ar', 'ary', 'arz', 'ckb', 'fa', 'glk', 'ks', 'mzn', 'pnb', 'ps', 'sd', 'skr', 'ug', 'ur',
|
|
'as', 'bn', 'bpy',
|
|
'awa', 'bh', 'dty', 'gom', 'hi', 'ks', 'mai', 'mr', 'ne', 'new', 'pi', 'sa',
|
|
'gu',
|
|
'pa',
|
|
'kn', 'tcy',
|
|
'km',
|
|
'ml',
|
|
'or',
|
|
'si',
|
|
'ta',
|
|
'te',
|
|
];
|
|
}
|
|
|
|
/**
|
|
* Gets whether or not we can split words arbitrarily, for example when highlighting the user's query in the search
|
|
* autocomplete widget.
|
|
*
|
|
* @param string $code
|
|
* @return bool
|
|
*/
|
|
public function canWordsBeSplitSafely( string $code ): bool {
|
|
return !in_array( $code, $this->splittableLanguages );
|
|
}
|
|
}
|