gplx/mediawiki/tests/phpunit/mocks/languages/DummyConverter.php

56 lines
958 B
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
use MediaWiki\Language\LanguageConverter;
use MediaWiki\Language\ReplacementArray;
/**
* Test converter (from Tajiki to latin orthography)
*/
class DummyConverter extends LanguageConverter {
/**
* @var array
*/
private $table = [
'б' => 'b',
'в' => 'v',
'г' => 'g',
];
/**
* Get Main language code.
*
* @return string
*/
public function getMainCode(): string {
return 'tg';
}
/**
* Get supported variants of the language.
*
* @return array
*/
public function getLanguageVariants(): array {
return [ 'tg', 'tg-latn', 'sgs', 'simple' ];
}
/**
* Get language variants fallbacks.
*
* @return array
*/
public function getVariantsFallbacks(): array {
return [];
}
public function loadDefaultTables(): array {
return [
'sgs' => new ReplacementArray(),
'simple' => new ReplacementArray(),
'tg-latn' => new ReplacementArray( $this->table ),
'tg' => new ReplacementArray()
];
}
}