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] Fallback to default language within internal linking suggestions if All Languages is selected, changed language error message #557

Merged
merged 1 commit into from
Sep 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ We will follow [Semantic Versioning](http://semver.org/).

## UNRELEASED
### Fixed
- Show warning on linking suggestions when content element is set to "All Languages" instead of fatal exception
- Show warning on linking suggestions when the language cannot be retrieved from the content element, use the default language in case "All Languages" is selected
- Added extra checks within the metatag generators in case fields do not exist (opengraph, twitter, robots)
- `hasSitemapFields` now correctly returns the `sitemapFields` instead of `yoastSeoFields`

Expand Down
4 changes: 4 additions & 0 deletions Classes/Form/Element/InternalLinkingSuggestion.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@ protected function getLocale(int $pageId): ?string
$siteFinder = GeneralUtility::makeInstance(SiteFinder::class);
try {
$site = $siteFinder->getSiteByPageId($pageId);
if ($this->languageId === -1) {
$this->languageId = $site->getDefaultLanguage()->getLanguageId();
return $site->getDefaultLanguage()->getTwoLetterIsoCode();
}
return $site->getLanguageById($this->languageId)->getTwoLetterIsoCode();
} catch (SiteNotFoundException|\InvalidArgumentException $e) {
return null;
Expand Down
2 changes: 1 addition & 1 deletion Resources/Private/Language/BackendModule.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@
<source>Unable to determine linking suggestions.</source>
</trans-unit>
<trans-unit id="tx_yoastseo_linking_suggestions.languageError" resname="tx_yoastseo_linking_suggestions.languageError">
<source>This content element does not have a language to analyze.</source>
<source>There was a problem retrieving the language information for this content element, check your site configuration.</source>
</trans-unit>

<trans-unit id="page" xml:space="preserve">
Expand Down