Translating into a specific variant of the same language is a special kind of translation. So the warning may help users to pay attention to the target language they selected:
Variant detection logic:
- If: target and source language are same, return false;
- Else:
- From the target language and source language, trim everything from and including the first hypen (-). Eg: en-ca would become en
- Compare the two resultant string and if they are equal then return true, else return false.
We should also check if the translation to target language is disabled (wgTranslateDisabledTargetLanguages), if so variant detection need not be run at all..