MediaWiki master
ILanguageConverter.php
Go to the documentation of this file.
1<?php
7namespace MediaWiki\Language;
8
13use Wikimedia\Parsoid\DOM\Document;
14use Wikimedia\Parsoid\DOM\DocumentFragment;
15
23
29 public function getVariants();
30
43 public function getVariantFallbacks( $variant );
44
50 public function getConvRuleTitle();
51
58 public function getConvRuleTitleFragment( Document $ownerDocument ): ?DocumentFragment;
59
65 public function getPreferredVariant();
66
72 public function getDefaultVariant();
73
83 public function validateVariant( $variant = null );
84
90 public function getURLVariant();
91
102 public function autoConvert( $text, $toVariant = false );
103
113 public function translate( $text, $variant );
114
121 public function autoConvertToAllVariants( $text );
122
133 public function convertSplitTitle( $title, ?string $variant = null );
134
142 public function convertTitle( $title );
143
151 public function convertNamespace( $index, $variant = null );
152
171 public function convert( $text );
172
184 public function convertTo( $text, $variant, bool $clearState = true );
185
197 public function findVariantLink( &$link, &$nt, $ignoreOtherCond = false );
198
204 public function getExtraHashOptions();
205
216 public function guessVariant( $text, $variant );
217
226 public function markNoConversion( $text, $noParse = false );
227
236 public function convertCategoryKey( $key );
237
244 public function updateConversionTable( PageIdentity $page );
245
253 public function hasVariants();
254
265 public function hasVariant( $variant );
266
275 public function convertHtml( $text );
276}
277
279class_alias( ILanguageConverter::class, 'ILanguageConverter' );
Represents a title within MediaWiki.
Definition Title.php:69
The shared interface for all language converters.
convertHtml( $text)
Perform output conversion on a string, and encode for safe HTML output.
getExtraHashOptions()
Returns language specific hash options.
updateConversionTable(PageIdentity $page)
Refresh the cache of conversion tables when MediaWiki:Conversiontable* is updated.
hasVariant( $variant)
Strict check if the language has the specific variant.
getConvRuleTitle()
Get the title produced by the conversion rule.
getConvRuleTitleFragment(Document $ownerDocument)
Get the title produced by the conversion rule, as a DocumentFragment owned by $ownerDocument.
getURLVariant()
Get the variant specified in the URL.
convertCategoryKey( $key)
Convert the sorting key for category links.
hasVariants()
Check if this is a language with variants.
translate( $text, $variant)
Translate a string to a variant.
autoConvertToAllVariants( $text)
Call translate() to convert text to all valid variants.
convertSplitTitle( $title, ?string $variant=null)
Automatically converts a LinkTarget or PageReference to a readable string in the preferred variant,...
convert( $text)
Convert text to different variants of a language.
validateVariant( $variant=null)
Validate the variant and return an appropriate strict internal variant code if one exists.
getPreferredVariant()
Get preferred language variant.
convertTitle( $title)
Automatically convert a LinkTarget or PageReference to a readable string in the preferred variant.
autoConvert( $text, $toVariant=false)
Dictionary-based conversion.
convertTo( $text, $variant, bool $clearState=true)
Same as convert() except a extra parameter to custom variant.
getVariantFallbacks( $variant)
In case some variant is not defined in the markup, we need to have some fallback.
guessVariant( $text, $variant)
Guess if a text is written in a variant.
getDefaultVariant()
This function would not be affected by user's settings.
getVariants()
Get all valid variants.
findVariantLink(&$link, &$nt, $ignoreOtherCond=false)
If a language supports multiple variants, it is possible that non-existing link in one variant actual...
convertNamespace( $index, $variant=null)
Get the namespace display name in the preferred variant.
markNoConversion( $text, $noParse=false)
Enclose a string with the "no conversion" tag.
Represents the target of a wiki link.
Interface for objects (potentially) representing an editable wiki page.
Interface for objects (potentially) representing a page that can be viewable and linked to on a wiki.