MediaWiki master
MediaWiki\Parser\Parsoid\LanguageVariantConverter Class Reference

Public Member Functions

 __construct (private readonly PageIdentity $pageIdentity, private readonly PageConfigFactory $pageConfigFactory, private readonly Parsoid $parsoid, private readonly SiteConfig $siteConfig, TitleFactory $titleFactory, private readonly LanguageConverterFactory $languageConverterFactory, private readonly LanguageFactory $languageFactory)
 
 convertPageBundleVariant (HtmlPageBundle $pageBundle, Bcp47Code $targetVariant, ?Bcp47Code $sourceVariant=null)
 Perform variant conversion on a HtmlPageBundle object.
 
 convertParserOutputVariant (ParserOutput $parserOutput, Bcp47Code $targetVariant, ?Bcp47Code $sourceVariant=null)
 Perform variant conversion on a ParserOutput object.
 
 disableFallbackLanguageConverter ()
 Disable fallback language variant converter.
 
 setPageConfig (PageConfig $pageConfig)
 Set the PageConfig object to be used during language variant conversion.
 
 setPageLanguageOverride (Bcp47Code $language)
 Set the page content language override.
 

Detailed Description

Since
1.40
Stability: unstable
should be marked stable before 1.40 release

Definition at line 33 of file LanguageVariantConverter.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Parser\Parsoid\LanguageVariantConverter::__construct ( private readonly PageIdentity $pageIdentity,
private readonly PageConfigFactory $pageConfigFactory,
private readonly Parsoid $parsoid,
private readonly SiteConfig $siteConfig,
TitleFactory $titleFactory,
private readonly LanguageConverterFactory $languageConverterFactory,
private readonly LanguageFactory $languageFactory )

Member Function Documentation

◆ convertPageBundleVariant()

MediaWiki\Parser\Parsoid\LanguageVariantConverter::convertPageBundleVariant ( HtmlPageBundle $pageBundle,
Bcp47Code $targetVariant,
?Bcp47Code $sourceVariant = null )

Perform variant conversion on a HtmlPageBundle object.

Parameters
HtmlPageBundle$pageBundle
Bcp47Code$targetVariant
?Bcp47Code$sourceVariant
Returns
HtmlPageBundle The converted HtmlPageBundle, or the object passed in as $pageBundle if the conversion is not supported.
Exceptions
HttpException

Definition at line 89 of file LanguageVariantConverter.php.

◆ convertParserOutputVariant()

MediaWiki\Parser\Parsoid\LanguageVariantConverter::convertParserOutputVariant ( ParserOutput $parserOutput,
Bcp47Code $targetVariant,
?Bcp47Code $sourceVariant = null )

Perform variant conversion on a ParserOutput object.

Parameters
ParserOutput$parserOutput
Bcp47Code$targetVariant
?Bcp47Code$sourceVariant
Returns
ParserOutput

Definition at line 169 of file LanguageVariantConverter.php.

◆ disableFallbackLanguageConverter()

MediaWiki\Parser\Parsoid\LanguageVariantConverter::disableFallbackLanguageConverter ( )

Disable fallback language variant converter.

Definition at line 183 of file LanguageVariantConverter.php.

◆ setPageConfig()

MediaWiki\Parser\Parsoid\LanguageVariantConverter::setPageConfig ( PageConfig $pageConfig)

Set the PageConfig object to be used during language variant conversion.

If not provided, the object will be created.

Parameters
PageConfig$pageConfig
Returns
void

Definition at line 64 of file LanguageVariantConverter.php.

◆ setPageLanguageOverride()

MediaWiki\Parser\Parsoid\LanguageVariantConverter::setPageLanguageOverride ( Bcp47Code $language)

Set the page content language override.

Parameters
Bcp47Code$language
Returns
void

Definition at line 74 of file LanguageVariantConverter.php.


The documentation for this class was generated from the following file: