49 $this->language = $langobj;
50 $this->titleFormatter = MediaWikiServices::getInstance()->getTitleFormatter();
58 return [ $this->language->getCode() => $text ];
74 return $this->titleFormatter->getPrefixedText( $linkTarget );
78 return $this->language->getFormattedNsText( $index );
85 return [ $this->language->getCode() ];
89 return $this->language->getCode();
93 return $this->language->getCode();
97 return $this->language->getCode();
128 if ( $variant ===
null ) {
131 $variant = strtolower( $variant );
132 return $variant === $this->language->getCode() ? $variant :
null;
172 return $variant && ( $variant === $this->
validateVariant( $variant ) );
184 return htmlspecialchars( $this->
convert( $text ) );
191class_alias( TrivialLanguageConverter::class,
'FakeConverter' );
Internationalisation code See https://www.mediawiki.org/wiki/Special:MyLanguage/Localisation for more...
A trivial language converter.
convertHtml( $text)
Perform output conversion on a string, and encode for safe HTML output.
translate( $text, $variant)
Translate a string to a variant.
hasVariants()
Check if this is a language with variants.
convert( $t)
Convert text to different variants of a language.
getURLVariant()
Get the variant specified in the URL.
TitleFormatter $titleFormatter
getPreferredVariant()
Get preferred language variant.
markNoConversion( $text, $noParse=false)
Enclose a string with the "no conversion" tag.
convertTitle(LinkTarget $linkTarget)
autoConvertToAllVariants( $text)
Call translate() to convert text to all valid variants.
getConvRuleTitle()
Get the title produced by the conversion rule.
getDefaultVariant()
Get default variant.
findVariantLink(&$l, &$n, $ignoreOtherCond=false)
If a language supports multiple variants, it is possible that non-existing link in one variant actual...
autoConvert( $text, $variant=false)
Dictionary-based conversion.
convertTo( $text, $variant)
Same as convert() except a extra parameter to custom variant.
getExtraHashOptions()
Returns language specific hash options.
guessVariant( $text, $variant)
Guess if a text is written in a variant.
reloadTables()
Used by test suites which need to reset the converter state.
updateConversionTable(LinkTarget $linkTarget)
Refresh the cache of conversion tables when MediaWiki:Conversiontable* is updated.
validateVariant( $variant=null)
Validate the variant and return an appropriate strict internal variant code if one exists.
convertCategoryKey( $key)
Convert the sorting key for category links.
convertNamespace( $index, $variant=null)
Get the namespace display name in the preferred variant.
hasVariant( $variant)
Strict check if the language has the specific variant.
getVariantFallbacks( $variant)
In case some variant is not defined in the markup, we need to have some fallback.
The shared interface for all language converters.