Skip to content

Conversation

@maikschneider
Copy link

Currently, the L parameter is always appended to links for both pages and content elements. However, this behavior is problematic when the source and target languages are identical.

When the language parameter is unnecessarily added, the target language becomes fixed, which is unintended. During record translations, links may point to the wrong language.

This PR introduces a check to compare the source and target languages. The L parameter will now only be added if the languages differ, ensuring links behave as expected during translations.

resolves #25

@sorenmalling
Copy link

This will also fix the issue that Linkvalidator can not match links to content elements.

The class TypolinkTagSoftReferenceParser::parse method uses a preg_match('/page\?uid=(\d+)#?(\d+)?/', $matches[1]) way to check if a links i broken (A content element is hidden/deleted).

When link2language builds a link it comes out as <a href="t3://page?uid=2879&amp;L=1#23260"> and the &amp;L=1 break the match and ends up not returning the id of the content element
Screenshot 2025-01-21 at 12 55 57

Compared to without the L parameter
Screenshot 2025-01-21 at 12 55 57

@achimfritz
Copy link
Contributor

solved with #28

@achimfritz achimfritz closed this Apr 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cannot link to content element without language parameter

3 participants