How can I generate a link in a proper way in Drupal 8? I have a field where the user can say an internal or external page/website.
How can I transform these into a link with the following condition:
the site root is: www.mydomain.com/mysite/
internal links should have language versions: i.e. en/articles or pt/articles .
I've tried with
Link::fromTextAndUrl('My link', Url::fromUri('internal:/articles')), but this requires a URI which is not my goal and it doesn't follow the selected user language.