Skip to content

Commit

Permalink
[BUGFIX] Fallback to default language within internal linking suggest…
Browse files Browse the repository at this point in the history
…ions if All Languages is selected, changed language error message
  • Loading branch information
Riny van Tiggelen committed Sep 18, 2023
1 parent 4dc99b9 commit d515174
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
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

0 comments on commit d515174

Please sign in to comment.