Feature summary (what you would like to be able to do and where):
Add mw.language:convertVariant(string $variant, string $text) to covert text to selected variant and add mw.frame:convert(string $text) to covert to current variant.
Use case(s) (list the steps that you performed to discover that problem, and describe the actual underlying problem which you want to solve. Do not describe only a solution):
https://www.mediawiki.org/wiki/Template:Localized_link use magic word {{PAGENAME}} to get pagename of translated, but it broken while title have language covert tag, example: https://www.mediawiki.org/w/index.php?title=Project:Sandbox&oldid=5089822
If we could covert it before pass it to magic word, it won't broken.