diff options
Diffstat (limited to 'MLEB/Translate/messagegroups/MessageGroupBase.php')
-rw-r--r-- | MLEB/Translate/messagegroups/MessageGroupBase.php | 65 |
1 files changed, 12 insertions, 53 deletions
diff --git a/MLEB/Translate/messagegroups/MessageGroupBase.php b/MLEB/Translate/messagegroups/MessageGroupBase.php index dfd62502..794faf26 100644 --- a/MLEB/Translate/messagegroups/MessageGroupBase.php +++ b/MLEB/Translate/messagegroups/MessageGroupBase.php @@ -8,6 +8,7 @@ * @license GPL-2.0-or-later */ +use MediaWiki\Extension\Translate\Services; use MediaWiki\Extension\Translate\TranslatorInterface\Insertable\CombinedInsertablesSuggester; use MediaWiki\Extension\Translate\TranslatorInterface\Insertable\InsertableFactory; use MediaWiki\Extension\Translate\Validation\ValidationRunner; @@ -91,24 +92,6 @@ abstract class MessageGroupBase implements MessageGroup { return $this->conf[$section][$key] ?? null; } - /** - * @return FFS - * @throws MWException - */ - public function getFFS() { - $class = $this->getFromConf( 'FILES', 'class' ); - - if ( $class === null ) { - return null; - } - - if ( !class_exists( $class ) ) { - throw new MWException( "FFS class $class does not exist." ); - } - - return new $class( $this ); - } - public function getValidator() { $validatorConfigs = $this->getFromConf( 'VALIDATORS' ); if ( $validatorConfigs === null ) { @@ -288,26 +271,13 @@ abstract class MessageGroupBase implements MessageGroup { return $code === $this->getSourceLanguage(); } - /** @deprecated Use getMessageGroupStates */ - public function getWorkflowConfiguration() { - global $wgTranslateWorkflowStates; - if ( !$wgTranslateWorkflowStates ) { - // Not configured - $conf = []; - } else { - $conf = $wgTranslateWorkflowStates; - } - - return $conf; - } - /** * Get the message group workflow state configuration. * @return MessageGroupStates */ public function getMessageGroupStates() { - // @todo Replace deprecated call. - $conf = $this->getWorkflowConfiguration(); + global $wgTranslateWorkflowStates; + $conf = $wgTranslateWorkflowStates ?: []; Hooks::run( 'Translate:modifyMessageGroupStates', [ $this->getId(), &$conf ] ); @@ -316,8 +286,6 @@ abstract class MessageGroupBase implements MessageGroup { /** @inheritDoc */ public function getTranslatableLanguages() { - global $wgTranslateBlacklist; - $groupConfiguration = $this->getConfiguration(); if ( !isset( $groupConfiguration['LANGUAGES'] ) ) { // No LANGUAGES section in the configuration. @@ -327,8 +295,8 @@ abstract class MessageGroupBase implements MessageGroup { $codes = array_flip( array_keys( TranslateUtils::getLanguageNames( null ) ) ); $lists = $groupConfiguration['LANGUAGES']; - if ( isset( $lists['blacklist'] ) ) { - $exclusionList = $lists['blacklist']; + $exclusionList = $lists['exclude'] ?? null; + if ( $exclusionList !== null ) { if ( $exclusionList === '*' ) { // All excluded languages $codes = []; @@ -343,21 +311,22 @@ abstract class MessageGroupBase implements MessageGroup { $codes = []; } - // DWIM with $wgTranslateBlacklist, e.g. languages in that list should not unexpectedly + $disabledLanguages = Services::getInstance()->getConfigHelper()->getDisabledTargetLanguages(); + // DWIM with $wgTranslateDisabledTargetLanguages, e.g. languages in that list should not unexpectedly // be enabled when an inclusion list is used to include any language. $checks = [ $this->getId(), strtok( $this->getId(), '-' ), '*' ]; foreach ( $checks as $check ) { - if ( isset( $wgTranslateBlacklist[ $check ] ) ) { - foreach ( array_keys( $wgTranslateBlacklist[ $check ] ) as $excludedCode ) { + if ( isset( $disabledLanguages[ $check ] ) ) { + foreach ( array_keys( $disabledLanguages[ $check ] ) as $excludedCode ) { unset( $codes[ $excludedCode ] ); } } } - if ( isset( $lists['whitelist'] ) ) { - $inclusionList = $lists['whitelist']; + $inclusionList = $lists['include'] ?? null; + if ( $inclusionList !== null ) { if ( $inclusionList === '*' ) { - // All languages included (except $wgTranslateBlacklist) + // All languages included (except $wgTranslateDisabledTargetLanguages) return null; } elseif ( is_array( $inclusionList ) ) { foreach ( $inclusionList as $code ) { @@ -369,16 +338,6 @@ abstract class MessageGroupBase implements MessageGroup { return $codes; } - /** - * List of available message types mapped to the classes - * implementing them. Default implementation (all). - * - * @return array - */ - public function getTranslationAids() { - return TranslationAid::getTypes(); - } - public function getSupportConfig(): ?array { return $this->getFromConf( 'BASIC', 'support' ); } |