In Content Translation, when a link from the source article cannot be added to the translation because the corresponding article does not exist in the target wiki, it is marked as unadapted (in grey) and users have the option to mark it as missing (in red) as described in T193233.
The link target of a red link points to an article that does not exist in the target Wikipedia. Determining such target is not easy. For example, a link that reads as "lemons" in the source article (English) points to the "Lemon" article, in the translation to German the expected result (assuming the article does not exist in German) would be to have a red link with the text "zitronen" that points to the missing "Zitrone" article.
The current approach is to use the title of the source article ("Lemon" in the example) for the link target of the red link. That will result in a red link labelled as "zitronen" (if MT is used) that points to "Lemon" in German Wikipedia. This is problematic since its encouraging the creation of an article titled in a different language than the one used in the wiki, and can collide with other existing articles (e.g., "Lemon" in German Wikipedia is a disambiguation page that links to articles of people with such surname).
# Proposed solution
The proposed solution consists in the following approaches that should be attempted in order until one is successful:
# If there is a label in the target language for the Wikidata item, use it as the link target for the red link. For example [[ https://www.wikidata.org/wiki/Q500 | Q500 ]] shows that the "Lemon" has a "Zitron" label for German, but even for wikis where the article does not exist such as Wolof Wikipedia it still has the "limoŋ" label in Wolof which would very likely be the article title to use there (better than just "Lemon").
# (Covered as part of a follow-up ticket: T224408) If machine translation is available for the language pair and applied to the paragraph, a translation of the source article name will be used for the target. In the example we'll take "Lemon" (not "lemons") and send it to Yandex to hopefully get "Zitrone".
# If there is no machine translation available (i.e., "copy from source" approach is used), the source link target will be kept for the translation, but the user will be able to edit/confirm as if the link tool were used. In the example, the "lemons" link will be transferred to German as "lemons", and the link card will show the non-existing "Lemon" page for the user to select. In this case the user will have to correct both the label and link target. An example sequence for this case is illustrated below.
|{F28124655,size=full}|{F28124659,size=full}|{F28124664,size=full}|
**What if there is already another page with the selected title?**
(Covered as part of a follow-up ticket: T224408)
Some of the approaches described above (1 and 2) should find a red link that is applied automatically. However, it is possible that the page title found is already taken by an existing article (which may or may not be the equivalent one). In such cases, the user is given the option to edit/confirm the link target.
As illustrated above, it is possible that even though "Lemon" in English is equivalent to "Zitron" in German, there is also an unrelated "Lemon" article in German. If we decide that the right target for the red link in German is "Lemon", it won't be possible to create such red link because the article is not missing.
In the case that an article (or redirect) already exists for the intended target, the result of clicking "mark as missing" won't be creating a red link directly. Instead, the insert link box will be opened with the intended text as search term. In this way the user can modify it (e.g., making it "Lemon (fruit)" instead) to create the appropriate red link (or link to the article if it happens to exist in the target language). The expected result is shown below:
{F22407453, size=full}