Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUGFIX] Do not set L parameter in case of linking to same language #26

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

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

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
2 participants